How to customize regex for input type tel in html5?

This is my current Regex:

<input type="tel" name="phone" value="" placeholder="Phone Number" title="019XXXXXXX" required pattern="[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{4}">

It forces users to key in 12 digits to pass through the validation.
But all I want to do is, to allow users to key in up to 12 digits ,min would be 9. ANd they can opt to include + sign too. Also except for the +, the rest must be numbers only.

How to modify the regex pattern for this rules please?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.