13. Regular Expression Summary

13.1. Quantifiers

A*             A sequence of zero or more 'A'
A+             A sequence of one  or more 'A'
A?             A sequence of one  or zero 'A'

A{2}           A sequence of exactly two 'A'
A{2,5}         A sequence of two through five (inclusive) 'A'
A{2,}          A sequence of two or more 'A'

13.2. Metacharacters

.              Any single character

^              Match the beginning of a string
$              Match the end of a string
^foobar$       A string that consists exactly of the word 'foobar'

\              Quote the next metacharacter
\$             A '$'

()             Grouping
|              Alternation (or)
(A|B|C)        Either 'A' or 'B' or 'C'
(A|B){2,}      A sequence of two or more 'A' or 'B' characters

[]             Character class
[0-9]          A   number between '0' and '9'
[a-f]          A   lower case letter between 'a' and 'f'
[G-Z]          An  upper case letter between 'G' and 'Z'
[^a-z]         Any character except characters between 'a' and 'z'
[0-9a-zA-Z\-]  A   hyphen or an alphanumeric character

13.3. Examples

([1-5]|[a-f])  Either a number between 1 and 5 or a lower case letter
               between 'a' and 'f'

^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)\.?$

A regular expression describing a fully qualified domain name (FQDN): 
(1) Beginning with a group (substring) comprising:
      first, an alphanumeric character 
        (a domain label must not start with a hyphen),
      followed by zero or more groups (substrings) containing
        zero or more hyphens or alphanumeric characters,
        followed by an alphanumeric character
	  (a domain label must not end with a hyphen).
(2) Followed by zero or more groups (substrings) 
      starting with a dot, 
      followed by an alphanumeric character,
      followed by zero or more groups (substrings) containing
        zero or more hyphens or alphanumeric characters,
        followed by an alphanumeric character.
(3) Followed by a group (substring) 
      starting with a dot, 
      followed by an alphabetic character 
        (the rightmost domain label must not start with a numeric character),
      followed by zero or more groups (substrings) containing
        zero or more hyphens or alphanumeric characters,
        followed by an alphanumeric character.
(4) Followed by an optional dot at the end.