Wildcard patterns can be used in many functions in Opus, including:
As well as regular expressions, Opus supports a more simple wildcard system, called the standard pattern matching system. When using wildcards, you specify a pattern consisting of a mix of literal text and special wildcard tokens. Each token is used to match one or more characters in the target string. As a simple example, the pattern *.doc matches anything that ends with the literal characters .doc (or in other words, document files).
Token |
Description |
---|---|
# |
The character or expression following the # is
repeated 0 or more times.
|
? |
Matches any single character.
|
| |
Used to separate multiple expressions, any of which may match
(effectively an or operator).
|
~ |
This is the not operator, it negates the following
expression.
|
() |
Parentheses are used to combine multiple characters into an expression. If we take the above example of a#(xyz)b, the parentheses are used to form xyz into a single expression. Without the brackets (i.e. a#xyzb) only the x would be seen to follow the # character - yzb would be treated literally. Parentheses can be nested (as in the above example for
~) to combine multiple expressions into a larger
expression.
|
[] |
Matches any single character in the set of specified characters. You can specify the character set as individual characters (e.g.
[abdfg]) or as a range of characters (e.g.
[a-j]) or as multiple ranges.
|
[~] |
Matches any character not in the set of specified
characters. See [] for information on how the set is
defined.
|
* |
Matches any number of characters, including zero. This is a synonym for #?. *.doc is equivalent to #?.doc. For example:
|
' |
The apostrophe is called the escape character.
|
grp: |
When using wildcards to match filenames this is a shorthand way to refer to all the file extensions defined by a file type group. For example, the Images group may contain the file
extensions .jpg, .bmp and .gif. If you wanted a
command to automatically select files of these types, you could use the
command:
A better way would be to use the grp: token to
automatically include all file extensions from that group:
|