Created
October 22, 2023 07:04
-
-
Save n-ii-ma/7d91c35255991e2bbf42c1fd9635c936 to your computer and use it in GitHub Desktop.
Regular expression for Iranian phone numbers
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
// Phone numbers in English/Farsi | |
export const dynamicNumPhone = | |
/^(09|۰۹)((0|۰)[\u06F0-\u06F50-5]|(1|۱)[\u06F0-\u06F90-9]|(3|۳)[\u06F0-\u06F90-9]|(2|۲)[\u06F0-\u06F30-3]|(9|۹)[\u06F0-\u06F30-3])[\u06F0-\u06F90-9]{7}$/; | |
// Phone numbers in English | |
export const englishNumPhone = | |
/^09(0[0-5]|1[0-9]|3[0-9]|2[0-3]|9[0-3])[0-9]{7}$/; | |
// Phone numbers in Farsi | |
export const farsiNumPhone = | |
/^۰۹(۰[\u06F0-\u06F5]|۱[\u06F0-\u06F9]|۳[\u06F0-\u06F9]|۲[\u06F0-\u06F3]|۹[\u06F0-\u06F3])[\u06F0-\u06F9]{7}$/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Totally appreciated, Thanks.