Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, August 25, 2011 3:10 PM
Hi
I have one regular expression [a-zA-Z0-9]+
i want to make max length of the expression to 10
can any one help on this to complete the regular expression
All replies (6)
Thursday, August 25, 2011 3:41 PM âś…Answered | 1 vote
Or:
string pattern = @"^[a-zA-Z0-9]{0,10}$";
or:
string pattern2 = @"^[\w\.]{0,10}$";
Mitja
Thursday, August 25, 2011 3:19 PM | 1 vote
try this [a-zA-Z0-9]{10}
Thursday, August 25, 2011 6:41 PM
Thanks perfect answer
Thursday, August 25, 2011 6:42 PM
Some correction in ur code
^[a-zA-Z0-9]{0,10}$
this is the correct one.
thanks for your time.
Thursday, August 25, 2011 7:18 PM
Ok, I`m glad it is.
BTW: whats the difference between mine:
@"^[a-zA-Z0-9]{0,10}$";
and yours:
"^[a-zA-Z0-9]{0,10}$"
?
I dont see any, its only an "@" mark, but its good to be there.
Mitja
Monday, August 29, 2011 6:58 AM
How is @"^\[\w\\\]{2,20}$" supposed to answer the question?