Regular Expression for the System-Supplied Any Format Dial Plan

Following is a second annotated example of a regular expression. This regular expression is specified for the system-supplied dial plan named Any Format.

([0-9a-zA-Z]+[-._])*[0-9a-zA-Z]+

  1. ([0-9a-zA-Z]+[-._])

    1. [0-9a-zA-Z]

    2. [-._]

  2. [0-9a-zA-Z]

This regular expression can be used to validate any phone number as well as the part of an email address preceding the @. For example:

123

5551234

555-1234

8005551234

1800FLOWERS

bruce.matthews

Following is a description of what this regular expression specifies:

Procedure


Step 1

The input text can start with zero or more sets of the following (* means “0 or more of the preceding”):

  1. one or more alphanumeric characters (0-9a-zA-Z) followed by

  2. one hyphen, period, or underscore.

Step 2

One or more alphanumeric characters (0-9a-zA-Z) must follow.