Correct the en-GB mobile validator. #1164
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have made a small modification to the en-GB mobile phone validator.
Mobile phone numbers in the UK always begin with 07. This is well known and was already being validated.
However, the next digit after 07 cannot be any digit; it can only be 1-9. Numbers starting 070 are not mobile numbers, they are in fact a rarely used form of premium rate number.
It is important for a validator to distinguish that 070 numbers are not mobiles as fraudsters have been known to use 070 numbers by fooling people into calling it, thinking they're calling a mobile, and then make money from the premium rate.
Therefore, I have modified the regex pattern for en-GB mobiles to exclude 070 numbers.
I have also added an 070 number to the tests, along with a couple of other non-mobile numbers to make sure the tests cover all the bases.