Last active
August 15, 2017 05:44
-
-
Save radislaw/28e961e8709dac173ff2f9da70223952 to your computer and use it in GitHub Desktop.
regexp for add space to phone number
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
| const phone = "+79009999999" | |
| const formatedPhone = phone.replace(/(\d{1})(\d{3})(\d{3})(\d{2})(\d{2})/, '$1 ($2) $3-$4-$5'); | |
| // -> "+7 (900) 999-99-99" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment