Skip to content
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

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

Open
Wigwamwam opened this issue Sep 16, 2024 · 0 comments

Comments

@Wigwamwam
Copy link

Wigwamwam commented Sep 16, 2024

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}$`)
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

No branches or pull requests

1 participant