Regular Expressions
In Regular Expressions mode, any text that is entered in the text box is interpreted as a regular expression.
Regular expressions are case-insensitive by default; that is, character case is ignored when making matches. Objects are filtered on whether their paths, or paths of their parents, contain the regular expression. Regular expressions behave quite differently from simple text fragments, in that they follow a particular set of rules and conventions that must be learned. For example, the period, ‘.’, in a regular expression represents any character, rather than just a period. In the context of a regular expression, the period can be called a metacharacter, as it has a programmatic function. For more information on using regular expressions, consult a suitable textbook. The full syntax permissible within the object selection dialog is detailed in the help page of the Java Pattern class. Some examples are given in the table below.
Example | Description |
---|---|
mir.*rt | Search for any object whose name contains text that starts with mir and ends with rt, and has any number of characters in the middle. The ‘*’ metacharacter indicates zero or more times. |
bar|log | The ‘|’ metacharacter indicates an OR relationship. This search finds any object whose name contains either bar or log. |
[0-9]+ | The [0-9] represents a single digit in the range 0 to 9, and the ‘+’ metacharacter indicates one or more times. This search finds any object that contains one or more digits in its name. |
[0-9]{2} | The {2} after the digit range indicates two times. This search finds any object that contains at least two consecutive digits in its name. Any number can be used within the {} brackets. |