Home

Appendix

Application Icon   Regular Expressions

Known to many people familiar with UNIX, regular expressions are a way to search strings using a specially defined pattern. The wildcards previously discussed are a small subset of regular expressions. Using combinations of the control characters and string, you can do some fairly sophisticated searches. While we can't provide an exhaustive, here are a few basic things to note when using regular expressions in EasyFind:

Substrings will be matched by default, so searching for lad will find 'lady', 'Aladdin', and 'ballad'. To match words bounded by spaces or punctuation, you can use \b at the start and end of the terms. You can use special characters called anchors to limit the search to terms found at the beginning or end of a string. You can use ranges, e.g., [a-z], but choices are put in parenthesis. For example, (Mon|Tues) must match one or the other.

Here is a brief list of some common characters and examples of their use:

  • Icon
    .: Denotes any value: character, digit, punctuation, or space.
  • Icon
    * : Matches zero or more of the character before it.
  • Icon
    ^ : Denotes the term is found at the beginning of the string.
  • Icon
    $: Denotes the term is found at the end of the string.
  • Icon
    {n}: Matches an explicit number of occurences of the preceding character. {n,m} can be used to match any number of items, from n to m. {n,} can be used to match the specified number of items or more.
  • Icon
    (a|b): Matches one or the other option.
  • Icon
    \b: Used before and after a term, this denotes a word boundary.

Example:

  • Icon
    fa.*: Remembering the . represents ANY character, this matches 'fa', 'far', 'fall', 'faulty', or 'Falmouth, Massachusetts'.
  • Icon
    ^doc.*: Matches any file beginning with 'doc' and any characters after it.
  • Icon
    readme.pdf$: Matches any file ending in 'readme.pdf'.
  • Icon
    [0-9]{8}: Matches at least eight digits in the name, noting this would match 8 digits in a string of ten digits, e.g., '0000000011' would still be matched.
  • Icon
    \b[0-9]{8}\b: Noting the word boundary being used, this matches only occurrences of eight digits in the name, for example, '20200101' would be matched.
  • Icon
    \bJ(a|i)m.*\b: Matches 'Jim' or 'James'.

Note: There are several flavors of regular expressions, each often having their own extensions. EasyFind supports basic expressions.