Pages

Sunday, May 16, 2010

Useful Regular Expression

For Alpha numeric :-

^[a-zA-Z0-9_]+$

Examples:-

ROOT, ROOT_One

For Numeric with Comma:-

^\$?(\d{1,3},?(\d{3},?)*\d{3}(.\d{0,3})?|\d{1,3}(.\d{2})?)$

Examples:-

1,111,11  

Numeric with 3 Digits(Compulsory with 0’s) :-

^[0-9]{3}$

Examples:-

000-999 integers where your has to enter three digits

001,003,343,999….

 

You can check any regular expression in the following URL it is a web based regular expression checker. Very useful.

http://www.rubular.com/