Home > DeveloperSection > Forums > How to solve Regular expression for validating ID in C# asp.net?
Ankit Singh

Total Post:341

Points:2389
Posted on    January-14-2015 10:00 PM

 ASP.Net C#  Regex 
Ratings:


 1 Reply(s)
 529  View(s)
Rate this:

What is Regular expression for validating ID in C# asp.net?

I'd like to allow only alphabets, numbers and _-.

Thanks in advance!



Tanuj Kumar

Total Post:134

Points:940
Posted on    January-14-2015 10:32 PM

Try this regex

^[\w_-]+$

It allows one or multiple numbers, alphabets (upper and lower case), _, - symbols.


Don't want to miss updates? Please click the below button!

Follow MindStick