Using patterns and regular expressions

You can use patterns and regular expressions to find and use custom snippets of data from documents.

Regular expressions

Regular expressions (regex for short) is a syntax for searching and retrieving text snippets in larger texts. It's very powerful for finding custom text patterns in your documents, but it's difficult to understand and use.

The syntax is to comprehensive to go into here. I recommend you use the documentation and interactive editor on regexr.com.

Another good resource is www.regular-expressions.info, where you can also find a list of examples.

Patterns

You can use patterns can acheive some of the same complexity without attempting to grasp regex.

Patterns

This rule will find all files that contains an email address from the @gmail.com domain, and move them to a folder.

I've created a pattern with the format [text]@gmail.com.

You can build patterns of the following elements:

  • Digit: A single digit, 0-9
  • Number: Any number, of multiple digits
  • Number with -,.: Also includes numbers like -14.534,56 or 34,349
  • Character: A single character a-z or A-Z, or any non standard character like æ, ø, å
  • Word: A word consisting of any number of characters, but not spaces and signs like "," and ".".
  • Text: Characters, numbers, signs, but not space or or white space
  • White space: spaces, tabs, line breaks

Regular expressions

For this example i've created a regex that finds email addresses that begins with "b". (The regex here is very simplified, and might not match all valid email addresses).

b\w+@\w+\.\w+

Documentation