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

Changing phone number validation pattern to allow extensions #498

Merged
merged 4 commits into from
Jun 6, 2024

Conversation

sachin-shrestha
Copy link
Collaborator

What type of PR is this?

Phone number validation pattern updated to allow extensions after the phone number.

@sachin-shrestha
Copy link
Collaborator Author

@jacobyavis @pjohnmeyer - looking for review/approval.

@sachin-shrestha
Copy link
Collaborator Author

@jacobyavis @pjohnmeyer - please review/approve. Thanks!

"type": "string",
"pattern": "^\\+\\d{1,3}\\s\\d{2,3}\\s\\d{2,3}\\s\\d{4}$"
"pattern": "^\\+\\d{1,3}\\s\\d{2,3}\\s\\d{2,3}\\s\\d{4}(?:\\s(ext.|extension)\\s\\d+)?$"
Copy link
Collaborator

@Sumukh Sumukh May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the TWG call, the lookahead seems unnecessary.

https://regexr.com/80kp6

^\+\d{1,3}\s\d{2,3}\s\d{2,3}\s\d{4}(\s(ext.|extension)\s\d+)?$ seems to work fine.

"type": "string",
"pattern": "^\\+\\d{1,3}\\s\\d{2,3}\\s\\d{2,3}\\s\\d{4}$"
"pattern": "^\\+\\d{1,3}\\s\\d{2,3}\\s\\d{2,3}\\s\\d{4}(?:\\s(ext.|extension)\\s\\d+)?$"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TWG Notes: See if the lookahead ?: at the beginning here is actually necessary, it seems redundant with the trailing ?. Also I don't believe JSON-schema patterns support ?: see https://json-schema.org/understanding-json-schema/reference/regular_expressions

@jacobyavis
Copy link
Collaborator

Pushed a change to remove the unnecessary lookahead.
Please review!

Copy link
Collaborator

@jacobyavis jacobyavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preparing to merge

@jacobyavis jacobyavis merged commit cc79c1a into main Jun 6, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

[Enhancement]: Validation for Phone Numbers does not currently include extensions
4 participants