The Daily Collegian Online - Published independently by students at Penn State
SEARCH
 Regular Expressions
For all practical purposes, regular expressions can only be used with the properties #Filename and #Path, and often those will return a "query too expensive" message.

Regular expressions are defined as follows:
Any character except asterisk (*), period (.), question mark (?), and vertical bar (|), defaults to matching just itself.

Regular expressions can be enclosed in matching quotes ("), and must be enclosed in quotes if they contain a space () ir closing parenthesis ()).

The characters *, ., and ? match any number of characters, match (.), or end of string, and match one character, respectively.

The character | is an escape character. After |, the following characters have special meaning:
    ( opens a group. Must be followed by a matching ).
    ) closes a group. Must be preceded by a matching (.
    [ opens a character class. Must be followed by an (un-escaped)].
    { opens a counted match. Must be followed by a matching }.
    } closes a counted match. Must be preceded by a matching {.
    , separates or clauses.
    * matches zero or more occurrences of the preceding expression.
    ? matches zero or one occurrences of the preceding expression.
    + matches one or more occurrences of the preceding expression.
  Anything else, including |, matches itself.

Between square brackets ([]) the following characters have special meaning:
    ^ matches everything but in the following classes. Must be the first character.
    ] matches ]. May only be preceded by ^, otherwise it closes the class.
    - range operator. Preceded and followed by normal characters.
    Anything else matches itself (or begins or ends a range at itself).

Between curly braces ({}) the following syntax applies:
    |{m|} matches exactly m occurrences of the preceding expression. (0<m<256).
    |{m|} matches at least m occurrences of the preceding expression. (1<m<256).
    |{m,n|} matches between m and n occurrences of the preceding expression, inclusive. (0<m<256, 0<n<256).

To match *, ., and ?, enclose them in brackets (for example, [*]sample, will match *sample.
Back to Search.
 



TOP  HOME
Blogs  About  Contact Us  Back Issues  Advertising 

Copyright © 2010 Collegian Inc.