Skip to content

Instantly share code, notes, and snippets.

@radislaw
Last active August 15, 2017 05:44
Show Gist options
  • Select an option

  • Save radislaw/28e961e8709dac173ff2f9da70223952 to your computer and use it in GitHub Desktop.

Select an option

Save radislaw/28e961e8709dac173ff2f9da70223952 to your computer and use it in GitHub Desktop.
regexp for add space to phone number
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