Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
i am making a username field in windows form.
i have find many regex but result is not good.
I have find this regex ^[a-z0-9_-]{3,16}$
which is taking value between 3 character to 16 characters. But it is not taking uppercase letter.
I am not a regex guru. Niether i added that code in my given regex.
Can anyone help me out
thanks in advance
Posted 29-Sep-12 19:18pm
Edited 29-Sep-12 19:23pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

How about:
Take a look at this too:
Expresso - A Tool for Building and Testing Regular Expressions[^]
sariqkhan at 30-Sep-12 0:27am
thanks bro. For helping
: )
sariqkhan at 30-Sep-12 0:33am
is there any thing to check whether - or underscore are at the end of the line? I want to avoid that username which have underscore or dash at end.
Kenneth Haugland at 30-Sep-12 0:44am
sariqkhan at 30-Sep-12 0:52am
this will matches the patters that there is underscore at end?
Kenneth Haugland at 30-Sep-12 0:57am
It will match if ther is NO underscore at the end the ^ inside the [] means not...
ridoy at 30-Sep-12 1:26am
sariqkhan at 30-Sep-12 1:34am
but bro it is taking special characters
like * + = how can i avoid that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 405
1 OriginalGriff 245
2 Sergey Alexandrovich Kryukov 207
3 Peter Leow 185
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 7,460
1 DamithSL 5,519
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514

Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 30 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100