How to solve Regular expression for validating ID in C# asp.net? Anonymous User189114-Jan-2015What is Regular expression for validating ID in C# asp.net?I'd like to allow only alphabets, numbers and _-.Thanks in advance!asp.netc# regex Updated on 14-Jan-2015
Anonymous User
14-Jan-2015Try this regex
^[\w_-]+$
It allows one or multiple numbers, alphabets (upper and lower case), _, - symbols.