Home
Index

# Using groups and backreferences with regular expressions

You can capture groups of a string with (…) and then back reference the groups with $1, $2, … where $1 references the first group, $2 the second group and so on.

## Using groups and backreferences example:

For example, to rename files "img_001.jpg", "img_002.jpg", ... to "01 - Photo.jpg", "02 - Photo.jpg", ...:

Drag in the files.

Click and choose Find & Replace.

Select “Regular expression”.

Type “img_0(\d\d)” in the “Find” box.

Type “$1 – Photo” in the “Replace” box.

Click Apply.

### Related Topics

regular expressions