Regular Expression For username

Posted by .Netlearner under ASP.NET on 7/26/2012 | Points: 10 | Views : 2196 | Status : [Member] | Replies : 7
Hello all,

I Want The regular expression that accepts the word os alphabets numbers and some special characters such as _ , . etc

eg) .netlearner_01

Please help




Responses

Posted by: Mallesh on: 7/27/2012 [Member] Starter | Points: 25

Up
0
Down
Hi, the pattern : \b[A-Za-z0-9._%-]\b is useful to fulfill your requirement.

With the above regular expression pattern, you can search through a text file to verify

if a given string looks like a word contains alphabets. numerics and .(dot), _(under score).

If you have any doubts make a post.





== Mallesh

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rock_Monu on: 7/27/2012 [Member] Starter | Points: 25

Up
0
Down
Hi, the pattern : \b[A-Za-z0-9._%-]\b is useful to fulfill your requirement.


.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 7/31/2012 [Member] Silver | Points: 25

Up
0
Down
You can test it in the regexlib...(http://regexlib.com/RETester.aspx)


.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/20/2012 [Member] Bronze | Points: 25

Up
0
Down
Please try this..

Regex regexObj = new Regex(^[A-Za-z]{2,}[_-]?[A-Za-z0-9]{2,}$);




.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/20/2012 [Member] Bronze | Points: 25

Up
0
Down
Please mark as answer if it helpful to u...That helps others who swaech the same..

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/20/2012 [Member] Starter | Points: 25

Up
0
Down
Regex regob=new Regex([a-zA-Z]+[0-9]+[a-zA-Z0-9]* );

Thanks & Regards
Hari

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/20/2012 [Member] Starter | Points: 25

Up
0
Down
Plz Mark As Answer if u satisfy with my answer.It is usefull to others

Thanks & Regards
Hari

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response