Renamer4Mac Help
← Back to the overview

Regular expressions

What is a regular expression?

Regular expressions allow you to search based on rules that form search expressions. This gives you a very powerful tool for search and replace.

You can read about regular expressions in many places - a short overview will follow bellow.

To those who prefer to read a printed documentation I recommend the following books: Regular Expressions or Regular Expressions Quick Reference.

Overview about regular expressions

Jokers

.Any single character
(hello|world)Either 'hello' or 'world'
[1-6]A number between 1 and 6
[c-h]A lower case character between c and h
[D-M]An upper case character between D and M
[^a-z]Absence of lower case a to z
[adx]One of the characters a, d or x
[a-z13]a lower case character or 1 or 3

Frequency

n*Zero or more of 'n'
n+One or more of 'n'
n?A possible 'n'
n{2}Exactly two of 'n'
n{2,}At least 2 or more of 'n'
n{2,4}From 2 to 4 of 'n'

Group

( )Parenthesis to group expressions

Position

^The pattern must be at the start of the string
$The pattern must be at the end of the string

Insert

When you want to re-insert a found string in the new name you must use a backslash followed by the number of the group. The complete search string is group 0.

Example: Search for "(Renamer[0-9]*)(Mac)", the text is "I frequently use Renamer4Mac":

\0= Renamer4Mac = Complete result
\1= Renamer4 = 1st group: "(Renamer[0-9]*)"
\2= Mac = 2nd group: "(Mac)"

← Back to the overview