I want to validate an Irish mobile phone number in the format xxx-xxxxxxx. The first three digits should be 083, 086, 087, or 089. The next seven digits should be integer numbers.
I tried using this HTML5 validation pattern:
<input type="text" id="phone_no" name="owner[phone]" value="" pattern="([0]{1}[8]{1}[3|6|7|9]{1}[0-9]{7})">
The code is not working. How can I validate this information?
sorry modify this
fairly old post but this might help anyone still looking for this
Anything you put in square brackets translates to "any of these characters".
So
1[abcde]2
is the same as1(a|b|c|d|e)2
Also, by default a single letter has size one. So
[x]{1}
is the same asx
.And
[0-9]
is the same as a digit, which can be expressed as\d
Try this regex, it's easier to understad: