Monday, 12 March 2012

Regular Expressions Validation Image extension using C# asp.net

ASP.Net - Regular Expressions Validation Image extension using C#
  
For Image:
((\S|\s)*)(\.(jpeg|.JPEG|jpg|.JPG|.gif|.GIF|.bmp|.BMP){1,})

"[a-zA-Z0_9].*\b(.jpeg|.JPEG|.jpg|.JPG|.jpe|.JPE|.png|.PNG|.mpp|.MPP|.gif|.GIF)\b"

For alpha :
[a-zA-Z0-9]+(((![$%@])||([a-zA-Z' '])){1,500})


[a-zA-Z0-9] --> should start with these letter only
[$%@] --> char in this part will not allow
[a-zA-Z' '] --> char in this part will allow
{1,500} --> min 1 char and 500 max