Hello,
I am using this phone module and I realized it doesn't support Finland phone numbers.
So I here is a patch which implements validation for Finland phone numbers.
Here is the details of the regular expression used here:
Start with either a local or international identifier:
* local identifier: 0
* International identifier: starting with + or 00 followed by an optional space and 358 which is Finland international prefix, plus another optional space here
Then the geographic or non-geographic code:
* Is composed of two digit from 10 to 99. Need some adjustment
Then 2 series of 2 to 4 digits and 1 optional serie of 1 to 3 digits, all optionally separated by spaces
source: http://en.wikipedia.org/wiki/Telephone_numbers_in_Finland
Comment | File | Size | Author |
---|---|---|---|
#5 | 2320765-add-finland-support-5.patch | 2.19 KB | MauPalantir |
#4 | 2320765-add-finland-support-3.patch | 2.14 KB | MauPalantir |
#2 | 2320765-add-finland-support-2.patch | 2.14 KB | MauPalantir |
#1 | 2320765-add-finland-support.patch | 2.23 KB | theo_ |
Comments
Comment #1
theo_ CreditAttribution: theo_ commentedComment #2
MauPalantir CreditAttribution: MauPalantir commentedI noticed some weird check on the regexp results which invalidated basically any phone number you entered, so removed them.
Comment #3
MauPalantir CreditAttribution: MauPalantir commentedTesting the patch I found another bug because the country code / 0 is attached to the whole phone number string, and if it was enered already in this format, then these prefixes are duplicated. Attached a patch version including the fix.
Comment #4
MauPalantir CreditAttribution: MauPalantir commentedTesting the patch I found another bug because the country code / 0 is attached to the whole phone number string, and if it was enered already in this format, then these prefixes are duplicated. Attached a patch version including the fix.
Comment #5
MauPalantir CreditAttribution: MauPalantir commentedFound another bug so the regexp does not accept an extra 0 after the country code if the code is provided. Also did some refactoring so the matches array doesnt capture the prefixes or whitespaces, to make formatting easier.