File tree Expand file tree Collapse file tree 4 files changed +9
-13
lines changed Expand file tree Collapse file tree 4 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,11 @@ public void IsMobilePhoneValid()
3737 Assert . IsTrue ( StringHelper . ValidateMobilePhone ( "+77015634321" ) ) ;
3838 Assert . IsTrue ( StringHelper . ValidateMobilePhone ( "+7015634321" ) ) ;
3939 Assert . IsTrue ( StringHelper . ValidateMobilePhone ( "+666567890345" ) ) ;
40+ Assert . IsTrue ( StringHelper . ValidateMobilePhone ( "+9944511122333" ) ) ;
41+ Assert . IsTrue ( StringHelper . ValidateMobilePhone ( "+9941234" ) ) ;
4042
4143 Assert . IsFalse ( StringHelper . ValidateMobilePhone ( null ) ) ;
42- Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "+7707596754215" ) ) ;
43- Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "87075967543" ) ) ;
44- Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "+7 701 56 34 321" ) ) ;
4544 Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "8 (701) 56 34 321" ) ) ;
46- Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "7072245456" ) ) ;
47- Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "2739956" ) ) ;
48- Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "273 99 56" ) ) ;
4945 Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "+7701563432A" ) ) ;
5046 Assert . IsFalse ( StringHelper . ValidateMobilePhone ( "+7701563432*" ) ) ;
5147 }
Original file line number Diff line number Diff line change 1- <?xml version =" 1.0" ?>
1+ <?xml version =" 1.0" ?>
22<package xmlns =" http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd" >
33 <metadata >
44 <id >Simplify.String.Sources</id >
1212 <description >String operations/validation functions</description >
1313 <summary >String operations/validation functions</summary >
1414 <releaseNotes >
15- + .NET Standard 2.0 support
16- * ValidateEMail reimplemented via System.Net.Mail.MailAddress internal validator
15+ Bug fixes
16+ * ValidateMobilePhone phone length validation fix
1717 </releaseNotes >
1818 <copyright >Licensed under LGPL</copyright >
1919 <language >en-US</language >
Original file line number Diff line number Diff line change 55 <Product >Simplify</Product >
66 <Description >String operations/validation functions</Description >
77 <Copyright >Licensed under LGPL</Copyright >
8- <Version >1.2</Version >
8+ <Version >1.2.1 </Version >
99 <PackageProjectUrl >https://github.com/SimplifyNet/Simplify</PackageProjectUrl >
1010 <PackageIconUrl >https://raw.githubusercontent.com/SimplifyNet/Images/master/Logo.png</PackageIconUrl >
1111 <RepositoryUrl >https://github.com/SimplifyNet/Simplify/tree/master/src/Simplify.String</RepositoryUrl >
1212 <RepositoryType >GIT</RepositoryType >
1313 <PackageTags >.NET</PackageTags >
1414 <PackageReleaseNotes >
15- + .NET Standard 2.0 support
16- * ValidateEMail reimplemented via System.Net.Mail.MailAddress internal validator
15+ Bug fixes
16+ * ValidateMobilePhone phone length validation fix
1717 </PackageReleaseNotes >
1818 <OutputPath >bin\Any CPU\$(Configuration)\</OutputPath >
1919 <DocumentationFile >bin\Any CPU\$(Configuration)\$(TargetFramework)\Simplify.String.xml</DocumentationFile >
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public static bool ValidateMobilePhone(string phone)
5252 if ( string . IsNullOrEmpty ( phone ) )
5353 return false ;
5454
55- return Regex . IsMatch ( phone , @"^\+[1-9]{1}[0-9]{7,11 }$" ) ;
55+ return Regex . IsMatch ( phone , @"^\+[1-9]{1}[0-9]{4,12 }$" ) ;
5656 }
5757
5858 /// <summary>
You can’t perform that action at this time.
0 commit comments