HOW TO SOLVE REGULAR EXPRESSION FOR VALIDATING ID IN C# ASP.NET?

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
C#  Regex 
 763  View(s)
Ratings:
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!

  1. Tanuj Kumar

    Post:134

    Points:940
    Re: How to solve Regular expression for validating ID in C# asp.net?

    Try this regex

    ^[\w_-]+$

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!