Gamal Elwazeery
Gamal Elwazeery

Reputation: 128

Input tel phone number validation pattern

I'm looking for the correct pattern for phone number validation by html5, In Egypt, all phone numbers starts with (01) and then nine numbers like this: 01123456789 I used this pattern to do this but it's not working right

<input type="text" name="phone" pattern="[01]{1}[0-9]{9}" title="Egypt Phone numbers">

Upvotes: 0

Views: 501

Answers (1)

Venkatesh R
Venkatesh R

Reputation: 514

try this if first two characters are static - 01

<input type="text" name="phone" pattern="01[0-9]{9}" title="Egypt Phone numbers"> 

Upvotes: 1

Related Questions