Regular Expressions¶
Regular expressions define patterns in strings that can be used to determine whether certain sequences of characters occur within a text.
In UltraSearch, regular expressions can be used to find specific files and / or folders that match the criteria specified by regular expressions. A list of special characters are supported.
To perform a search using a regular expression, place a tilde ~ in front of your search term. For example, entering ~a|b will find all files and folders whose names contain either “a” or “b”.
Note: The UltraSearch search is case-insensitive. Regular expressions are matched without distinguishing between upper- and lower-case letters, so a pattern such as [a-z] also matches the corresponding upper-case letters (and vice versa). The case-sensitive-looking ranges in the examples below (for example A-Za-z) are therefore only used for readability — you do not need to specify both cases.
Examples of the most used syntax and providers¶
Expression |
Syntax |
Description |
Example |
|---|---|---|---|
Any character |
|
Matches any single character except a line break. |
|
Zero or more |
|
Matches zero or more occurrences of the preceding expression, and makes all possible matches. |
|
One or more |
|
Matches at least one occurrence of the preceding expression. |
|
Start of string |
|
Matches the start of a string |
|
End of string |
|
Matches the end of a string |
|
Beginning of word |
|
Matches only when a word starts at this point in the text. |
|
End of word |
|
Matches only when a word ends at this point in the text. |
|
Any one character in the set |
|
Matches any one of the characters in the []. To specify a range of characters, list the starting and ending characters separated by a dash (-), as in [a-z]. |
|
Any one character not in the set |
|
Matches any character that is not in the set of characters that follows the ^. |
|
Or |
|
Matches either the expression before or the one after the OR symbol (|). Mostly used in a group. |
|
Escape character |
|
Matches the character that follows the backslash () as a literal. This lets you find the characters that are used in regular expression notation, such as { and ^. |
|
Repeat n times |
|
Matches n occurrences of the preceding expression. |
|
Grouping |
|
Lets you group a set of expressions together. If you want to search for two different expressions in a single search, you can use the Grouping expression to combine them. |
If you want to search for |
More examples:¶
Regular Expression |
Use Case |
|---|---|
|
Find all files/folders with at least one digit in its name. |
|
Find all files/folders containing “a” or “b” in their name. |
|
Find all files/folders containing at least one character in their name that is not a letter. Because the search is case-insensitive, |
|
Find all files/folders which start with an “E” followed by exactly 7 digits. |
|
Find all files/folders with a folder depth of at least 2 and at most 4. |
|
Find all files/folders with invalid ASCII characters. |
|
Find all files/folders with Unicode characters which cannot be printed. |
|
Find all file/Folder names that contain the non-breakable space character (Unicode NOBR, U+00A0) instead of a normal space character. |
|
Find all file and folder names, that contain characters which are invalid on SharePoint servers. |
|
Find all files and folders with a leading space. |
|
Find files with an extension that have a trailing space at the end of their name. |
|
Find folders with a trailing space at the end of their name |
Tools for creating regular expressions¶
https://regex101.com/ (online)
http://regexpal.com/ (online)
http://sourceforge.net/projects/regextester/ (download)
http://sourceforge.net/projects/regaxe/ (download)