position: absolute
This file contains 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
// Validate numbers that starts with '+98' or '09' and 9 digits after. | |
// It also works with persian numbers. | |
const regex = /^((\+98|0|\+۹۸|۰)(9|۹)[0-9-۰-۹]{9})$/; | |
console.log(regex.test("+989121234567")); // true | |
console.log(regex.test("۰۹۱۲۱۲۳۴۵۶۷")); // true | |
console.log(regex.test("۰۹12۱۲34۵۶7")); // true | |
console.log(regex.test("+۹۸۹۱۲1234567")); // true | |
console.log(regex.test("+98912123456789")); // false |