Showing
1 changed file
with
4 additions
and
2 deletions
@@ -203,8 +203,10 @@ class GetUtils { | @@ -203,8 +203,10 @@ class GetUtils { | ||
203 | r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'); | 203 | r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'); |
204 | 204 | ||
205 | /// Checks if string is phone number. | 205 | /// Checks if string is phone number. |
206 | - static bool isPhoneNumber(String s) => hasMatch(s, | ||
207 | - r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$'); | 206 | + static bool isPhoneNumber(String s) { |
207 | + if (s == null || s.length > 16 || s.length < 9) return false; | ||
208 | + return hasMatch(s, r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$'); | ||
209 | + } | ||
208 | 210 | ||
209 | /// Checks if string is DateTime (UTC or Iso8601). | 211 | /// Checks if string is DateTime (UTC or Iso8601). |
210 | static bool isDateTime(String s) => | 212 | static bool isDateTime(String s) => |
-
Please register or login to post a comment