Regex for accepting all type of phone numbers in javascript validation -
i'm using below regex accepting phone numbers,
/^\+?(\d[.\- ]*){9,12}(e?xt?\d{1,5})?$/;
but want accept following phone numbers also(specially indian mobile , landlines):
+91 9970464878 +91-22-22221500 09970464878 9970464878
you can add 3 possiblities start of regex.
this regex once used on similiar requirement :
^(?:(?:\+|0{0,2})91(\s*[\-]\s*)?|[0]?)?\d{10}$
note - have strip away hyphens, dont think required validations.
here regular expression analyzer explanation.
Comments
Post a Comment