Hello, i know this question has been asked a million times but I just cant seem to get it right. I googled and found this and tried to use the pattern given but still the pop up still shows. I don't know what im doing wrong but its getting frustrating as obviously it worked for the person but not for me unfortunately.

<input type="tel" name="phone" placeholder="+60##-#######" pattern="/^(7|8|9)\d{9}$/" title="7878787878" required>

as you can see what i wanted is a pattern for +60##-####### but couldn't figure it out so as i said i tested with the one from the link but when i enter 7878787878 the pop up still says, "please follow requested format" although this pattern worked for the person.

i tried my own pattern /^(+60)\d{2}\(-)\d{7}$/, entered an invalid pattern and no pop up came out. please help me. and thank you in advance.

10 Months
Discussion Span
Last Post by diafol

Try without the delimiters and boundaries


okay so i removed the slashes and it worked. so i tried to put in the pattern that i actually wanted which is a pattern like +6012-3456789 but i only achieved 12-3456789. how do i make it so that +60 has to be entered and in that order +60.

what i have:

<input type="tel" name="phone" placeholder="+6012-3456789" pattern="^[1-9]\d{1}-[0-9]\d{6}$" title="+6012-3456789" required>


I did this:

<input type="tel" name="phone" placeholder="+6012-3456789" pattern="^[+](6)(0)[1-9]\d{1}-[0-9]\d{6}$" title="+6012-3456789" required>

it works.. but is there a better way? or this is the way?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.