-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TextBoxRegEx doesn't validate Phone Numbers in (###) ###-#### format properly #1821
Comments
Here is a regex that i built.
Below is all formats that it would match. here is a link to regexr.com Let me know if this fits the requirement and I will do a PR. |
Thanks @avknaidu, I think we should address this in 3.0, as I think it'll be hard to validate all the same scenarios from the current regex to the new regex and people's expectations. We probably also want to have different modes for International vs US/Canada. This also seemed pretty comprehensive: http://phoneregex.com Unfortunately it also looks like the C# port of libphonenumber is out of date. |
libphonenumber is updated just 8 hrs ago on nuget. are you saying it still does not handle all scenario's? |
This issue seems inactive. Do you need help to complete this issue? |
If we can avoid adding another dependency, I think we should try. |
I think a generic solution for phone numbers is fine and users can add their own regex for their needs |
This issue seems inactive. Do you need help to complete this issue? |
1 similar comment
This issue seems inactive. Do you need help to complete this issue? |
Agree with @skendrot, let's not add another dependency and instead try to solve this through a regex |
By default, this control looks for a custom regular expression in order to check their inputs. In other words, if you don't force this control to validate phone numbers, you will be able to set your own format validation through a custom regular expression by declaring the For more information, you can check the control documentation: https://docs.microsoft.com/en-us/windows/uwpcommunitytoolkit/extensions/textboxregex |
Since the refactor of the phone number method will be a breaking change and it's possible to work around this problem by setting a custom RegEx to check the input values @nmetulev can we close this issue? |
I don't think it's a breaking change as right now it doesn't work as expected, phone numbers should be recognized. We should update the regex here which should resolve the issue when ValidationType="PhoneNumber" is used. |
@avknaidu Do you want to provide a PR with your regex? |
@skendrot will do |
PR merged |
I'm submitting a...
Current behavior
Entering a phone number in the style
(###) ###-####
is marked as invalid both of the sample apps phone number examples.Expected behavior
Should be recognized as a valid phone number.
Minimal reproduction of the problem with instructions
(###) ###-####
formatNote: it's marked as invalid.
Environment
The text was updated successfully, but these errors were encountered: