The regular expression syntax used in the Internet Utilities is a subset of the regular expression syntax specified in the POSIX standards:
A pattern comprises a list of branches, separated by | if there is more than one. Each branch comprises a series of consecutive pieces, all of which must match in the given order for the branch as a whole to match. Each piece comprises an ^, $, or an atom followed by an optional suffix operator *, ?, or &plus.. An atom is a character set, a subexpression enclosed in parentheses, ., or a literal character.
Character sets comprise a list of characters, character ranges, and character classes, enclosed within '[' and ']'. A match occurs if the target character is in the set, unless the entire set is prefixed by the '^' character (which is not part of the set itself) in which case a match occurs if the target character is not in the set. A character range is two characters separated by a '-', and includes all characters lexically from the first to the second. A character class is a class name ("alpha", "digit", "alnum", "xdigit", "graph", "space", "print", "upper", "lower", "cntrl", or "punct") enclosed within "[:" and ":]", and denotes all characters in that class. To include the ']' character as part of the set, list it before all other characters. To include the '-' character as part of the set, list it before all other characters except ']'.
\+[0-9]+[- ][- 0-9]+