Skip to content

Instantly share code, notes, and snippets.

@MoienTajik
Last active November 29, 2025 07:27
Show Gist options
  • Select an option

  • Save MoienTajik/acd3dbb359054bd22e06cc97281934eb to your computer and use it in GitHub Desktop.

Select an option

Save MoienTajik/acd3dbb359054bd22e06cc97281934eb to your computer and use it in GitHub Desktop.
Regex For Iranian Mobile Phone Numbers

Regex For Iranian Phone Numbers

This regex supports all kinds of Iranian mobile phone numbers :

^(\+98|0)?9\d{9}$


Regex Visualized

Usage in JavaScript :

var regex = new RegExp('^(\\+98|0)?9\\d{9}$');
var result = regex.test('+989031234567');

console.log(result);

Regex Tester Demo

JSFiddle Demo

@m-nt
Copy link

m-nt commented Nov 16, 2025

this support all new mobile operator format
/^09(0[1-5]|1[0-9]|2[012]|3[0235-9]|9[0-4]|98|99)\d{7}$/

this doesn't include +989000000000

@Rava-milad
Copy link

For that you can use this regex: /(^(0?9)|(\+?989))((14)|(13)|(12)|(19)|(18)|(17)|(15)|(16)|(11)|(10)|(90)|(91)|(92)|(93)|(94)|(95)|(96)|(32)|(30)|(33)|(35)|(36)|(37)|(38)|(39)|(00)|(01)|(02)|(03)|(04)|(05)|(41)|(20)|(21)|(22)|(23)|(31)|(34)|(9910)|(9911)|(9913)|(9914)|(9999)|(999)|(990)|(9810)|(9811)|(9812)|(9813)|(9814)|(9815)|(9816)|(9817)|(998))\W?\d{3}\W?\d{4}/gm

I should mention that in my previous regex I only focused on validating real Iranian mobile number prefixes rather than just the general phone number structure, and since in my environment there was no need for supporting the “+98” format, I didn’t include it.
This new regex is taken from the Iranian Phone Number Validation repository, which provides a more complete and standardized list of valid prefixes.

@m-nt
Copy link

m-nt commented Nov 29, 2025

👌👌

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