Created
July 11, 2017 14:16
-
-
Save basilalex/4ccc3fa4548118bc037cc8592f359f0b to your computer and use it in GitHub Desktop.
Паттерн форматирования номера телефона для Украины.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input | |
type="tel" | |
name="phone" | |
placeholder="Телефон" | |
pattern="[\+]\d{2}\s[\(]\d{3}[\)]\s\d{3}[\-]\d{2}[\-]\d{2}" | |
minlength="13" | |
maxlength="13" | |
/> |
дякую за патерн, скористалась!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Корректнее будет
pattern="[\+]\d{3}\s[\(]\d{2}[\)]\s\d{3}[\-]\d{2}[\-]\d{2}"
т.к. код Украины +380, а не +38.-> http://www.countrycallingcodes.com/country.php?country=Ukraine