Mobile number regex with 12 digit ?

0
Hi Experts,   I have to restrict mobile  number only 12 digit not more than 12    Can any one share the exact regex  ?   Thanks in advance..
asked
4 answers
6

Hi Neil,

 

You can try this regex, this one is working fine for me.
 

isMatch($PersonalDetails/Mobile,'^(\+\d{1,3}[- ]?)(?!0+$)(?!1+$)\d{12}$')

Here you can add the country code also  eg(+91,+111)
 

If you don’t want a country code use this one  ^([- ]?)(?!0+$)(?!1+$)\d{12}$

I hope it helps

answered
5

Hi Neil,

 

Check out the phone number regex in the below link with multiple regex formats.

^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$

 

https://ihateregex.io/expr/phone/ 

 

You can also validate your regex in the below link

https://regex101.com/ 

answered
0

Hi Neil,

Use the below regex format to check 12 digit validation.

@"^[0-9]{12}$"

answered
0

Bookmarking it for future reference

answered