How to transfer phones of the form +79033838833 to the view +7 (930) 383-88-33?

2 answers 2

Very approximately through the replacement of the regular season:

var tel = '+79031559499'; var tel = tel.replace(/\+7(\d{3})(\d{3})(\d{2})(\d{2})/, '+7 ($1) $2-$3-$4'); console.log(tel); 

PS And it is not clear that this in your question one phone number has changed into a completely different one.

  • corrected. this is for example. just need to convert this mask - werty
 jQuery(function($){$("#phone").mask("(999) 999-9999");}); 

Use the script mask for the number - link

  • one
    And jQuery wasn't actually asked. - Qwertiy