Regular Expression - Allows numbers, but not the dotted line punctuation mark
I want to write a regex. Here is my basic requirement:
- Allow only 11 numbers.
- There cannot be a dash (
-
) inside these 11 numbers.
Here is the regex I wrote:
\d{11}[^-]
Examples:
a) 12345654321 => Valid
b) 123-4567890 => Invalid
c) -1234567890 => Invalid
d) 1234567890- => Invalid
I didn't get the correct result. How do I fix this?
+3
source to share