# Regular expressions

Regular expressions are sets of symbols that you use to create queries to match property values in properties other than Contents and All. For a table of regular expression symbols supported by the query language, see Regular expression operators.

You cannot use the Contents and All properties with regular expressions.

The following table provides examples of the long and short forms of regular expression queries:

Short form | Long form | Result
#filename *.avi | {prop name=filename} {regex}*.avi {/regex} | Any file with the .avi extension (usually sound and moving picture files)

Note

- If a property query contains an asterisk (*), question mark (?), or vertical bar (|), it is automatically treated as a regular expression regardless of what mode is indicated.

## Sample regular-expression queries

Example | Query | Result
Group | #filename = *|(ss|,ing|).cxx | Returns all documents with file names ending with either "ss" or "ing" and having the extension "cxx."
NOT operator (^) | #filename = |[^f]*.cxx | Returns all documents with file names starting with any letter other than "f" and having the extension "cxx."
Range operator (–) | #filename = |[a-d]*.cxx | Returns all documents with file names starting with a letter in the range a through c and having the extension "cxx."
Exact-count match | #filename = *s|{2|}.cxx | Returns all documents with file names ending with exactly two "s" characters and having the extension "cxx."
At least one match | #filename = es|{1,|}.cxx | Returns all documents with file names that are combinations of the string "es" and have the extension "cxx." Files named "es.cxx" and "eses.cxx" match, but "esese.cxx" does not.
Matches between two particular variables | #filename = ci|{2,4}.cxx | Returns all documents with file names that are combinations of two to four occurrences of the string "ci" and have the extension "cxx." Files named "cici.cxx" and "cicicici.cxx" match, but "ci.cxx" does not.
Zero or more matches | #filename = c|*ss.cxx | Returns all documents with file names starting with zero or more "c" characters, ending with "ss," and having the extension "cxx." Files named "ss.cxx," "css.cxx," and "cccccss.cxx" match, but "cctss.cxx" does not.
Zero or one match | #filename = c|?ss.cxx | Returns all documents with file names starting with zero or one "c" character, ending with "ss," and having the extension "cxx." Files named "ss.cxx" and "css.cxx" match.
One or more matches | #filename = c|+ss.cxx | Returns all documents with file names starting with one or more "c" characters, ending with "ss," and having the extension "cxx." Files named "css.cxx" and "cccccss.cxx" match, but "cctss.cxx" and "ss.cxx" do not.