I want a regular expression that accepts all numbers, alphabets and only the hyphen (‐) from special characters.
I am trying this expression: ^\d+$/[-]/[a-z] but it does not work. I want to accept expressions like this one:
Emp-IN-0000001
Can someone help me with this?
If it’s always this format (Emp-IN-0000001), then use this regexp:
or, if you have extended regexps:
when there are always seven digits, use this:
You can even say:
if it’s exactly “Emp-IN-” + digits.
Btw, this is not C# specific, you can use these regular expressions with any language, as long as they support regexps at all.