Phone number validation on catalog form

raj99918
Tera Contributor

Hi ,

 

Phone number validation on form it should contains only numbers with - and + 

 

How can I achieve this one from regex?

 

Thanks 

10 REPLIES 10

AshishKM
Kilo Patron
Kilo Patron

Hi @raj99918

Configure the regular expression for phone number and use that on catalog item variabls.

 

^(\+\s?\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]\d{4}$

 

AshishKMishra_0-1712176218845.png

 

 

Set the regex with phone number variabbles.

 

AshishKMishra_2-1712176333287.png

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

HI @AshishKM  Thanks for the reply its failing no luck just I want regrex like Contain numbers (0 to 9), dash (-) and plus (+) character could you please give regrex for this one?

Hi @raj99918 ,

 

Did you get a chance to look at my solution ?

 

Thanks,

Swathi

kkrushkov
Mega Sage

Hi, @raj99918 

 

You can check the following article:

Solved: Regex for phone numbers. - ServiceNow Community

 

Also try this regex:

 

/^\+?\d+(-\d+)*$/;

 

 

Hi @kkrushkov But its not allowing the country code numbers with any country code like India +91 9999999999, UK +44 123567890 its just allowing the just numbers and - like this However I want regrex to allow which contains numbers - +