Validating input in perl

Rated 3.92/5 based on 788 customer reviews

Since a question mark is used after each separator, the phone number digits are allowed to run together.Note that although this recipe claims to handle North American phone numbers, it’s actually designed to work with (NANP) numbers.

⋯ # [Match the remaining digits and separator.] $ # Assert position at the end of the string..Letters, numbers, and underscore are all considered word characters (see Recipe 2.6).Note that the first word boundary token appears after the optional, opening parenthesis.New area codes that fit the rules listed earlier are made available regularly, and even if a phone number is valid, that doesn’t necessarily mean it was issued or is in active use.Two simple changes allow the previous regular expression to match phone numbers within longer text: matches the position between a word character and either a nonword character or the beginning or end of the text.

Leave a Reply