Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Validating EURO phone numbers #125

Closed
jdriesen opened this issue Jul 22, 2016 · 4 comments
Closed

Validating EURO phone numbers #125

jdriesen opened this issue Jul 22, 2016 · 4 comments

Comments

@jdriesen
Copy link

Hi sir,

Can you please tell me how I can validate a European phone number ?
(in other words... can you please add a regular expression for this, like you did for euro_date ?)

Some test data (for Belgium)
+32 ppp xx xx xx (mobile number in Belgium, always 3 digits for the provider)
+32 a xxx xx xx ( land number with one digit for the area)
+32 aa xx xx xx ( land number, with 2 digits for the area)

this algorithm covers almost all possibilities in Europe

Thanks in advance for your reply,
Kind regards,
Johnny Driesen

@ghiscoding
Copy link
Owner

Can you submit a PR yourself?
You simply have to look at the validation-rule.js file and just add a switch case. That would be great if you could.

@jdriesen
Copy link
Author

OK.... Will give it a try this weekend, and will keep you posted.
Grtz,
Johnny

@ghiscoding
Copy link
Owner

I will push a new revision soon for a small fix, then I started looking at the Regex you provided. This seems like a Regex for internal phone number, not really specific to Europe and it seems very loose since it's only checking for last numbers to be between 6 and 14.

I could maybe add this as phone_international, but is it really what you want, is it strong enough?

@ghiscoding
Copy link
Owner

Since I add to push a new revision for another fix, I added as well the Regular Expression pattern that is mentioned in your article to create the new phone_international validation. It is now part of the latest version 1.5.4, be sure to update the package.

On another note, you wanted to know how to add a regex. You can use Regex directly with Angular-Validation see this Wiki - Regular Expression Pattern

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants