Remove regular expression as validation method #686
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using regular expressions for Phone Validation was deprecated as of .Net Framework 4.7.2 and not in any version of .Net Core
Here's the compatability post on removing regex and the default validator in
[Phone]
:https://github.com/Microsoft/dotnet/blob/master/Documentation/compatibility/aspnet-472-compat-doc.md
And .NET Core no longer users regular expressions to determine phone number format validity at all (Presumably because of the best practices on Regex and injection/security concerns)
Here's the source code for core without a Regex in sight:
https://github.com/dotnet/corefx/blob/v2.1.5/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/PhoneAttribute.cs
Not sure if the description can be forked by API version / framework, but it looks like this single file is serving as the doc for both .NET Framework and .NET Core, and seems easier to just remove the regular expression bit as it's certainly incorrect in the case of Core, but if there's a way to version the comments, then let me know in the PR and I can update the commit to seperate by version.