Wednesday, 18 June 2014

Regular Expression Collection

invalid charecters ^[^<>`'~}%:;^#{*=|?]+$
email \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
website ^(((ht|f)tp(s?))\://)?(www.|[a-za-z].)[a-za-z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-za-z0-
max 8 numberic (^[0-9]{1,8})+(\[0-9])?
only .gif, .jpg, .png and .jpeg files valid for picture (.*\.([gg][ii][ff])|.*\.([jj][pp][gg])|.*\.([jj][pp][ee][gg])|.*\.([bb][mm][pp])|.*\.([pp][nn][gg])|.*\.([tt][ii][ii][ff])$)
fax [\ \/\(\)\.\+0-9\-]{7,20}
date format (dd-mm-yyyy) (0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](18|19|20)\d\d
minimum 5 character .{5}.*
date format ^(\d{1,2})-(\d{1,2})-(\d{4})$
only numeric with minimum 10 and maximum 15 ^[0-9]{10,15}
6 digits ^[0-9]{6}
two decimal digits ^[0-9]{1,2})+(\.[0-9]{1,2}
only numeric ^[0-9]+(\[0-9])?
time format ^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$|^(__:__)$
For more details:http://msdn.microsoft.com/en-us/library/ff650303.aspx