Regular Expression Syntax
- Last Updated: December 11, 2024
- 1 minute read
- WhatsUp Gold
- Version 2024
This table lists the meta-characters understood by the WhatsUp Gold Regex Engine.
Matching a Single Character
Meta-character | Matches | |
|---|---|---|
|
|
dot |
Matches any one character |
|
|
character class |
Matches any character inside the brackets.Example, [abc] matches "a", "b", and "c" |
|
|
negated character class |
Matches any character except those inside the brackets.Example, [^abc] matches all characters except "a", "b", and "c".See below for alternate use - the way ^ is used controls its meaning. |
|
|
dash |
Used within a character class. Indicates a range of characters.Example: [2-7] matches any of the digits "2" through "7".Example: [0-3a-d] is equivalent to [0123abcd] |
|
|
escaped character |
Interpret the next character literally. Example: 3\.14 matches only "3.14". whereas 3.14 matches "3214", "3.14", "3z14", etc. |
|
|
binary character |
Match a single binary character. nn is a hexadecimal value between 00 and FF.Example: \\x41 matches "A"Example: \\x0B matches Vertical Tab |
Quantifiers
Meta-character | Matches | |
|---|---|---|
|
|
question |
One optional. The preceding expression once or not at all.Example: colou?r matches "colour" or "color"Example: [0-3][0-5]? matches "2" and "25" |
|
|
star |
Any number allowed, but are optional.Example: .* Zero or more occurrences of any character |
|
|
plus |
One required, additional are optional.Example, [0-9]+ matches "1", "15", "220", and so on |
|
|
"Non-greedy" versions of ?, +, and *. Match as little as possible, whereas the "greedy" versions match as much as possibleExample: For input string <html>content</html><.*?> matches <html><.*> matches <html>content</html> |
Matching Position
Meta-character | Matches | |
|---|---|---|
|
|
caret |
Matches the position at the start of the input.Example: ^2 will only match input that begins with "2". Example: ^[45] will only match input that begins with "4" or "5" |
|
|
dollar |
At the end of a regular expression, this character matches the end of the input.Example: >$ matches a ">" at the end of the input. |
Other
Meta-character | Matches | |
|---|---|---|
|
|
alternation |
Matches either expression it separates. Example: H|Cat matches either "Hat" or "Cat" |
|
|
parentheses |
Provides grouping for quantifiers, limits scope of alternation via precedence.Example: (abc)* matches 0 or more occurrences of the the string abcExample: WhatsUp (Gold)|(Professional) matches "WhatsUp Gold" or "WhatsUp Professional" |
|
|
backreference |
Matches text previously matched within first, second, etc, match group (starting at 0).Example: <{head}>.*?</\0> matches "<head>xxx</head>". |
|
|
negation |
The expression following ! does not match the inputExample: a!b matches "a" not followed by "b". |
Abbreviations
Abbreviations are shorthand Meta-characters.
Abbreviation | Matches |
|---|---|
|
|
Any alphanumeric character: ([a-zA-Z0-9]) |
|
|
White space (blank): ([ \\t]) |
|
|
Any alphabetic character: ([a-zA-Z]) |
|
|
Any decimal digit: [0-9] |
|
|
Any non decimal digit: [^0-9] |
|
|
Any hexadecimal digit: ([0-9a-fA-F]) |
|
|
Newline: (\r|(\r?\n)) |
|
|
Any punctuation character: ,./\';:"!?@#$%^&*()[]{}- _=+|<>!~ |
|
|
Any non-punctuation character |
|
|
A quoted string: (\"[^\"]*\")|(\'[^\']*\') |
|
|
WhatsUp Gold style white space character: [ \\t\\n\\r\\f\\v] |
|
|
WhatsUp Gold style non-white space character:[^ \\t\\n\\r\\f\\v] |
|
|
Any word characters (letters and digits): ([a-zA-Z0-9_]) |
|
|
Non-word character: ([^a-zA-Z0-9_]) |
|
|
An integer: ([0-9]+) |