How to create a regular expression for a phone number in JavaScript, for example:
+71234567890 Moreover, it is necessary that the expression select only numbers after +7 , that is, the search result will be 1234567890
How to create a regular expression for a phone number in JavaScript, for example:
+71234567890 Moreover, it is necessary that the expression select only numbers after +7 , that is, the search result will be 1234567890
var phone = '+71234567890', reg = /^\+7(\d{10})$/; console.log( phone.match(reg)[1] ); +61-2-1234 5678 :) - user207618+7 , gave an example - I brought out the regular season - Yuri alert( '+71234567890'.match(/\+7([0-9]+)$/)[1] ); Source: https://ru.stackoverflow.com/questions/636873/
All Articles