Var isPhoneNumber = Regex.IsMatch(phoneNumber, phoneNumber, (isPhoneNumber ? string. Phone numbers are not an ideal candidate for regular expressions. By using capturing groups to remember each set. This approach also has the added advantage of leaving you with some easy to digest regular expressions.If your intent is merely to validate that the input is a phone number or not, rather than trying to capture anything, you can use the static Regex.IsMatch function: var isPhoneNumber = Regex.IsMatch(phoneNumber, "(1-)?\\p a valid US number." A regular expression can easily check whether a user entered something that looks like a valid phone number. PHONE NUMBER REGEX CODE
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |