Skip to content

Additional prefix in UK. #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

g1smd
Copy link
Contributor

@g1smd g1smd commented May 21, 2013

It will be another 4 or 5 years before the next mobile prefix change after that.

@jzaefferer
Copy link
Collaborator

Thanks. Could you add sample numbers to the unit tests for each?

@@ -389,14 +389,14 @@ jQuery.validator.addMethod('phoneUK', function(phone_number, element) {
jQuery.validator.addMethod('mobileUK', function(phone_number, element) {
phone_number = phone_number.replace(/\(|\)|\s+|-/g,'');
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[45789]\d{2}|624)\s?\d{3}\s?\d{3})$/);
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1345789] could also be expressed as [^26\D], but I don't know if that would hurt readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually try to avoid negatives, for that very reason.

Additionally, [345] could be expressed as [3-5] and [789] could be expressed as [7-9] but it is the same number of characters.

In a few years time, when 072xx xxxxxx numbers come into use, it can be simplified to 7([1-5789]\d{2}|624)\d{6} and by then it may be that the rest of 76xx beyond 7624 has been opened up too allowing the much simplified 7[1-9]\d{8} instead.

@jzaefferer
Copy link
Collaborator

Thanks! Landed as a single commit.

Btw. when you add commits, adding a comment here helps, since there's no notifications for new commits.

@g1smd
Copy link
Contributor Author

g1smd commented May 22, 2013

Thanks! I wasn't aware of the lack of notifications. I'll add a comment next time.

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

Successfully merging this pull request may close these issues.

3 participants