Regular expressions are written in a formal language that can be interpreted by a regular expression processor. You can use special characters and character sets in regular expressions to configure rules or property mappings in task routes.
A character class is a defined set of characters and is enclosed in brackets. Any character that is specified in a character class except the special characters \ ^ - ] adds that character to the possible matches for the character set.
(?=.*[[:lower:]])(?=.*[[:upper:]])(?!.*[[:punct:]]).{8,}
(?i)car matches car and CAR.
| Character or character class | Description | Example |
|---|---|---|
| \ | The backslash escapes special characters so that they are treated as literals. | \+ matches + |
| [ ] | The brackets enclose a character class. | [abc] |
| ^ | The caret matches at the start of the string
to which the regular expression is applied. If a bracket expression begins with the caret, it matches the complement of the characters it contains (negation). |
^. matches a in abc/xyz [^x-z] matches any character that is not in the range x to z |
| $ | The dollar sign matches the end of the string to which the regular expression is applied. | .$ matches z in abc/xyz |
| | | The vertical bar is used for alternatives and
matches either of its arguments. Parentheses are used to group alternatives. |
abc|def|xyz matches abc, def,
or xyz abc|(def|xyz) matches abcdef or abcxyz |
| ? | The question mark makes the item that directly
precedes it optional. It is also used to set up lazy quantification. |
abc? matches ab or abc |
| * | The asterisk indicates zero or more occurrences of the item that directly precedes it. | ab*c matches ac, abc, abbc, or abbbc |
| + | The plus sign indicates one or more occurrences of the item that directly precedes it. | ab+c matches abc, abbc, or abbbc, but not ac |
| () | Parentheses are used to group the parts of the regular expression. | gr(a|e)y matches gray or grey |
| - | The hyphen specifies a range of characters unless it is specified immediately after an opening bracket. In this case, it is used literally. | [A-Za-z0-9] matches any letter or digit |
| . | The period matches any single character. | |
| (?=pattern) | This construct matches something that is followed by a given pattern. | a(?=b) matches the a and only the a in cab, but does not match bath or bar. |
| (?!pattern) | This construct matches something that is not followed by a given pattern. | a(?<!b) matches the a and only the b in bath or bar, but does not match the a in cab. |
| (?<=pattern) | This construct matches something that is prededed by a given pattern. | (?<=a)b matches the b and only the b in cab, but does not match bed or debt. |
| (?<!pattern) | This construct matches something that is not prededed by a given pattern. | (?<!a)b matches the b and only the b in bed or debt, but does not match the b in cab. |
| \< | This escape sequence matches a the start of a word. | \<ton matches tons but not button. |
| \> | This escape sequence matches a the end of a word. | \>ton matches button but not tons. |
| \Q...\E | This sequence matches the characters between \Q and \E literally. | \Q+-*/\E matches +-*/ |
| \d, \w, and \s | These shorthand character classes match the
digits 0 - 9, word characters (letters, digits, and the underscore),
and white space. \d is equivalent to [:digit:]. \w is equivalent to [:word:]. \s is equivalent to [:space:]. |
[\d\s] matches a character that is a digit or white space |
| \D, \W, and \S | These shorthand character classes are negated
versions of the character classes that match digits, word characters,
or white space. \W is equivalent to ^ [:word:]. \S is equivalent to ^ [:space:]. |
\D matches a character that is not a digit |
| \b | This shorthand character class matches a word boundary (the start or end of a word) unless it is specified inside a character class. In this case, \b is a backspace character. | .\b matches c in abc |
| \B | This shorthand character class matches only when it is not at a word boundary. | \B.\B matches y in xyz |
| \A | This shorthand character class matches at the start of the string to which the pattern is applied. | \A. matches a in abc |
| \z | This shorthand character class matches the end of the string to which the pattern is applied. | \z. matches c in abc |
| {n} | This quantifier repeats the item that directly precedes it exactly n times, where n is an integer equal to or greater than 1. | a{3} matches aaa |
| {n,m} | This quantifier repeats the item that directly precedes it between n and m times, where n is an integer equal to or greater than 0 and m is an integer equal to or greater than n. | a{2,4} matches aaaa, aaa, or aa |
| {n,} | This quantifier repeats the preceding item at least n times, where n is an integer equal to or greater than 0. | a{2,} matches aaaaa in aaaaabc |
| [:alphanum:] | This character class matches any alphanumeric character. | |
| [:alpha:] | This character class matches any alphabetic character. | |
| [:blank:] | This character class matches any white space that is not a newline character. | |
| [:cntrl:] | This character class matches any control character, for example, the newline character or the backspace character. | |
| [:digit:] | This character class matches any decimal digit. [:digit:] is equivalent to \d. |
|
| [:graph:] | This character class matches any graphical character: alphanumeric or punctuation. | |
| [:lower:] | This character class matches any lowercase character. | |
| [:print:] | This character class matches any printable character: alphanumeric, punctuation, or space. | |
| [:punct:] | This character class matches any punctuation character. | |
| [:space:] | This character class matches any white space,
such as the blank character, the newline character, or the tab character. [:space:] is equivalent to \s. |
|
| [:upper:] | This character class matches any uppercase character. | |
| [:word:] | This character class matches any word character:
letters, digits, and the underscore. [:word:] is equivalent to \w. |
|
| [:xdigit:] | This character class matches any hexadecimal digit. |
