ali raza

C#, .Net ,Asp.net and my thoughts

Category Archives: regular expression

Nice Regular expression for text input

i found a use full regular expression vaildating input string, you can use it to filter sql injection attacks while taking input for username, title ect.

^[a-zA-Z]+(([\.\- ][a-zA-Z0-9 ])?[a-zA-Z0-9]*)*$

regular expression for email address validation

hi use this regular expression for email address validation
^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$

Regular expression validator in asp.net would be like

Chears…

Regular expression for html Table Parsing

here are some Regular expressions for html parsing . you can use it in your application while parsing html table to fetch data from it

  1.  Table Expression  = “<table[^>]*>(.*?)</table>”  
  2.   Header Expression  = “<th[^>]*>(.*?)</th>”  
  3.   Row Expression  = “<tr[^>]*>(.*?)</tr>”  
  4.   Column Expression  = “<td[^>]*>(.*?)</td>”