Reputation: 889
I have a phone number input field where it must:
I tried but my best result was ng-pattern="/^\+?\d{0,11}?$/"
.
How to make this work?
Upvotes: 0
Views: 2391
Reputation: 392
Seems like you're trying to match a phone number? Maybe this is helpful: What regular expression will match valid international phone numbers?
Otherwise, if no particular order or restrictions for your numbers, +
, -
or spaces, this should do the work: /^[0-9\+\-\s]{1,12}$/
https://regex101.com/r/kuc5OF/2
Upvotes: 1