Wildcards and Regular Expressions
Wildcards
Wildcards allow a single special character to denote missing parts of a word.
Character |
Description |
---|---|
* |
Denotes any value or character, such as any letter or sequence of letters (including the empty sequence). For example, the search term "calc*" would match all of the words "calc", "calculation", "calcutta" and "calcium". |
? |
Denotes a single character. For example, "an?" will match any one of "and", "ant", "any" or "ann". |
# |
Denotes a digit. For example, "Decision#" will match any one of "Decision1", "Decision2", "Decision3" … "Decision9". |
Regular Expressions
Blue Prism uses the Microsoft .NET Regular Expression classes. The regular expression patterns are defined by a special syntax or language, which is compatible with Perl 5 regular expressions.
The following table lists some of the metacharacters commonly used in Regular Expression searches. To use any of the following characters in the regular expression as a character rather than their function, they must be preceded by the escape character (\).
Character |
Description |
---|---|
\ |
Escape character. Use before any other character in this list to use the following character as itself instead of its function. For example, "\*" to indicate an asterisk. |
[ ] |
Used to define a character group. For example, [a-z] matches any lowercase character. |
( ) |
Used to define a sub-expression group. For example, "a(bc)d" will match the "bc" in "abcd", will not match the "bc" in "fbcd". |
. |
Wildcard character. Matches any single character except new line "\n". To match any character including the "\n", use a pattern such as "[\s\S]". |
* |
Matches the preceding element or sub-expression zero or more times. For example, zo* matches "z" and "zoo". * is equivalent to {0,}. |
+ |
Matches the preceding element or sub-expression one or more times. For example, "zo+" matches "zo" and "zoo", but not "z". + is equivalent to {1,}. |
? |
Matches the preceding element or sub-expression zero or one time. For example, "do(es)?" matches the "do" in "do" or "does". ? is equivalent to {0,1} |
{ } |
Used to define a qualifier group. Qualifier groups define how many times an element or sub-expression should match. For example, "o{2}" does not match the "o" in "Bob", but it does match the double-instance of "o" in "food" (and will return "oo" as a result). |
^ |
The match must occur at the beginning of the string. |
$ |
The match must occur at the end of the string or before a new line. |
| |
Used to define alternation constructs. Matches one of the two patterns on either side of the | character. For example, gr(a|e)y matches to gray or grey. |
How to use regular expressions
For further information about regular expressions and the full range of options available, see the .NET Framework Regular Expressions and Regular Expression Language – Quick Reference pages on Microsoft's online documentation. The regular expressions engine is invoked with default options set.