Regular Expressions

Regular Expressions (also known as regex's) are similar to Windows Wildcards. Both are used to perform pattern matching. However, regex's are far more powerful than wildcards.

Windows Wildcards

Windows style wildcards uses 5 meta-characters to do pattern matching. The '*' character matches any sequence of characters, while the '?' character matches any single character. The other meta-characters are outlined in the PFrank help manual.

If you are using wildcards in the PFrank name filter to match filenames, then you can match all filenames ending in '.doc' with the expression '*.doc' . If you want to match filenames that start with 'A' and end in a 2 letter extension then you would use 'A*.??' .

Wildcards aren't used in PFrank for filename replacement patterns.

Regular Expressions

Regular expressions define many more meta-characters than Windows wildcards to assist in pattern matching. One of the meta characters is '.' which matches any single character. Another is '+' which is like a repeat counter. If you put a '+' after any character it specifies that you are searching for that character repeated 1 or more times. Another repeat specifier is the '*' . If you put a '*' character after any character, it specifies that you are searching for that character repeated 0 or more times. One of the most important meta characters is the '\' . It allows you to search for characters in strings that are the same as meta characters. i.e. if you want to search for filenames that have a '.' , then you would specify '\.' . There are many more meta-characters that are fully explained in the built-in PFrank help manual or any of the references that it lists.

If you are using regex's in the PFrank name filter to match filenames, then you can match all filenames ending in '.doc' with the expression '.+\.doc' . This reads as: search for any character 1 or more times, followed by a '.' , followed by 'doc' . If you want to match filenames that start with 'A' and end in a 2 letter extension then you would use 'A.*\...' . This reads as: search for 'A' followed by 0 or more occurrences of any letter, followed by a '.' , followed by any 2 other characters.

If you are using regex's in the PFrank custom renaming patterns to replace filenames, then you can do things like search for parts of filenames that end in '.MP3' or '.Mp3' and change those parts to '.mp3'. One way to do this is to search for '\.[Mm][Pp]3' and replace it with '.mp3'

More information on how to to use regular expressions for pattern searching and replacing can be found in the built-in PFrank help manual or the links listed in the following sections.

Tutorials

Below are some external links to sites with information on how to use regular expressions:

Regular Expression Tutorial
Python Regular Expressions
Wikipedia Regular Expressions - Contains a large list of references at the end of the page.

More tutorials can be found using the 'Google' search engine and searching for the phrase "regular expression" and the word "tutorial".

Quick Reference

A handy regular expression quick reference is available here