Skip to content

E164 compliance regex is wrong must not accept phone numbers without "+" at the beginning #195

@Wigwamwam

Description

@Wigwamwam

Hey, noticed that your source to the stack overflow regex reference for e164 compliant phoneNumbers is incorrect - https://stackoverflow.com/a/23299989. In the comments of the thread it states:

The "+" is not optional in E.164 for services like Twilio, so remove the ? after the + ^\+[1-9]\d{1,14}$ – 

This is backed up by the Twilio page: https://www.twilio.com/docs/glossary/what-e164 - they make reference to the correct regex:
^\+[1-9]\d{1,14}$

Therefore the regex must be the following:

// E164 regex source: https://www.twilio.com/docs/glossary/what-e164
reE164 = regexp.MustCompile(`^\+[1-9]\d{1,14}$`)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions