Need help for limitation of starting phone number by 9

Hi all,

I have one question.....I want to limit phone numbers to 9 digits and to start only by digit "9". So I used regex(.,'^[0-9]{9}$') and it works but what I need is---I just want to start the first number by "9" only. In my case if I start by 8 it accepts, but I need to start by 9 only.

1 Like

Hi @Yordanos

maybe I'm not a regex expert but what about ^9[0-9]{8}$?

1 Like

Thank you for you response. I tried but it doesn't work. It says "Value not allowed"

What value not allowed? Where do you see that message?

After I do this regex(.,'^9[0-9]{9}$').....I tried to test it on "Enketo"......and it says "Value not allowed"

Maybe because it should be regex(.,'^9[0-9]{8}$') not regex(.,'^9[0-9]{9}$') (since you want to have 9 numbers in total)? If not please attach the sample number you are trying to validate?

Oh yeah you are right it should be {8}. Now, It works. Thanks a lot!!