Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 20, 2010 09:49 AM by Shengqing Yang - MSFT
Member
24 Points
99 Posts
Aug 19, 2010 02:04 PM|LINK
Hi,
I am looking for a regular expression which validates conditions below,
1. 5 character lenght (Min & Max)
2. Must start with a letter ( A or C)
3. Textbox canbe left blank
4. Should not contain all numerics.
I have a basic expression below, but I don't know how to extend it.
^[0-9a-zA-Z]{5}
Thanks
725 Points
163 Posts
Aug 20, 2010 06:26 AM|LINK
Basically, point 3 and 4 are not required as the first character must be A or C. Try the following expression:
^(A|C)[0-9a-zA-Z]{4}$
All-Star
45968 Points
2997 Posts
Aug 20, 2010 09:49 AM|LINK
Can you make some explanation on the third and the last points? What did you mean by "Textbox canbe left blank" and "Should not contain all numerics" as the string is only 5 char-length?
Best Regards, Shengqing Yang
Venkat Ganes...
Member
24 Points
99 Posts
Regex for Alphanumeric with length (must start with a letter A or C)
Aug 19, 2010 02:04 PM|LINK
Hi,
I am looking for a regular expression which validates conditions below,
1. 5 character lenght (Min & Max)
2. Must start with a letter ( A or C)
3. Textbox canbe left blank
4. Should not contain all numerics.
I have a basic expression below, but I don't know how to extend it.
^[0-9a-zA-Z]{5}
Thanks
PeterCwpan
Member
725 Points
163 Posts
Re: Regex for Alphanumeric with length (must start with a letter A or C)
Aug 20, 2010 06:26 AM|LINK
Basically, point 3 and 4 are not required as the first character must be A or C. Try the following expression:
^(A|C)[0-9a-zA-Z]{4}$
Shengqing Ya...
All-Star
45968 Points
2997 Posts
Re: Regex for Alphanumeric with length (must start with a letter A or C)
Aug 20, 2010 09:49 AM|LINK
Hi,
Can you make some explanation on the third and the last points? What did you mean by "Textbox canbe left blank" and "Should not contain all numerics" as the string is only 5 char-length?
Best Regards,
Shengqing Yang
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework