Skip to content

Update metadata for support Pakistan 326 codes #113

@aikikode

Description

@aikikode

This library has the same issue as nyaruka/phonenumbers#110: due to outdated metadata Pakistan mobile phone matching pattern is

national_number_pattern:"3(?:[014]\\d|2[0-5]|3[0-7]|55|64)\\d{7}" possible_length:10 example_number:"3012345678"

That only includes codes 320-325, while 326 is also a valid one.

The code:

package main

import (
    "fmt"
    "github.com/ttacon/libphonenumber"
)

func main() {
    parsedPhoneNumber, _ := libphonenumber.Parse("0325-0000000", "PK")
    fmt.Println(parsedPhoneNumber, libphonenumber.IsValidNumber(parsedPhoneNumber))
    parsedPhoneNumber, _ = libphonenumber.Parse("0326-0000000", "PK")
    fmt.Println(parsedPhoneNumber, libphonenumber.IsValidNumber(parsedPhoneNumber))
}

Provides:

country_code:92 national_number:3250000000  true
country_code:92 national_number:3260000000  false // should be true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions