Regular Expression C#
1)
String should have lower
case alphabets."^[a-z]+$"
2)
String should
havealphabets. "^[a-zA-Z]+$"
3)
String having alphabets and
length must be
4."^[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]$"or"^[a-zA-Z]{4}$
4)
String having alphabets and length must be
greater than 2 and less than 10."^[a-zA-Z]{3,9}$"
5)
Age validation must be 1 or 2 digit and
integer."^\d{1,2}$""^[0-9]{1,2}$"or
"^([0-9]|[0-9][0-9])$"or "^([0-9]|[0-9]{2})$"
6)
Mobile Number patter. digit
11 length."^[0-9]{11}$";
7)
Mobile Number have 11 digits and starts with
03."^03[0-9]{9}$"
8)
Mobile Number starts with 03 next
two char must be digits from 0 to 5 nextchar must be - and next 7 char must be
digit"^03[0-5]{2}-[0-9]{7}$"
Comments
Post a Comment