Skip to content

Instantly share code, notes, and snippets.

@n-ii-ma
Created October 22, 2023 07:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n-ii-ma/7d91c35255991e2bbf42c1fd9635c936 to your computer and use it in GitHub Desktop.
Save n-ii-ma/7d91c35255991e2bbf42c1fd9635c936 to your computer and use it in GitHub Desktop.
Regular expression for Iranian phone numbers
// 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}$/;
@mohammad-kazemzadeh
Copy link

Totally appreciated, Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment