Security

Reply
Regular Contributor I

Phone number validation

Hi,

 

To check the guest's phone numbers, I use the validator "NwaSmsIsValidPhoneNumber". It works fine but now I need to force guests to add a + before the number. Like +044234657890

 

How can I do this ?

 

Thanks

 

Dimitri

MVP

Re: Phone number validation

Change the Validator to IsRegExMatch and use this regex:

 

^\+(?:[0-9] ?){6,14}[0-9]$

 

That should enforce the E.164 standard.


Regards
John Solberg

-ACMX #316 :: ACCP-
Intelecom - Norway
----------------------------
Remember to Kudo if a post helped you! || Problem Solved? Click "Accept as Solution" in a post!
Regular Contributor I

Re: Phone number validation

Thanks, I will try it.

 

Dimitri

Regular Contributor I

Re: Phone number validation

A fast feedback, working fine thanks.

 

Dimitri

Regular Contributor I

Re: Phone number validation

Hi,

 

I need a new regex that checks that there are only numbers with no spaces and max lenght is 15 digits. Anyone can help me, thanks.

 

Regards

 

Dimitri

MVP

Re: Phone number validation

Many regex testers and libraries out there mate. [0-9]{15} is the simple answer.

Regards
John Solberg

-ACMX #316 :: ACCP-
Intelecom - Norway
----------------------------
Remember to Kudo if a post helped you! || Problem Solved? Click "Accept as Solution" in a post!
Regular Contributor I

Re: Phone number validation

Ok thanks, it's allright.

Aruba

Re: Phone number validation

Try using /^\d\d\d-\d\d\d-\d\d\d\d$/ You just need to remove the - if you don't want the standard US format
Thank You,
Troy

--Give Kudos: found something helpful, important, or cool? Click Kudos Star in a post.

--Problem Solved? Click "Accepted Solution" in a post.
Aruba

Re: Phone number validation

 
Thank You,
Troy

--Give Kudos: found something helpful, important, or cool? Click Kudos Star in a post.

--Problem Solved? Click "Accepted Solution" in a post.
Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: