Useful regular expressions

Regex syntax is :

Regex re = new Regex("Regular Expression string",Regular Expression Options);

Regular Expression Options are options that we can use along with regular expression like RegexOptions.IgnoreCase or RegexOptions.Compiled

Here I am lisitng some Regular Expressions:

[a-zA-Z]* - Regular Expression to allow only charactors

[0-9]* - Regular Expression to allow only numbers

[a-zA-Z0-9]* - Regular Expression to allow only alphanumeric charactors

[0-9]*(\.[0-9]{1,2})? - Regular Expression to validate a float number with 1 or 2 decimal points

Read Users' Comments (0)

0 Response to "Useful regular expressions"

Post a Comment