Regular Expressions in Renamer Plugin
The Renamer plugin uses more powerful regular expressions than the Find and Internal Viewer in Sally. It extends the REGEXP library, the great work of Henry Spencer. First read the Regular Expressions Syntax in Sally, then continue with the description of Renamer extensions. These extensions were inspired by Perl.
Extended syntax
- '*?' - non-greedy variant of '*' (match 0 or more times)
- '+?' - non-greedy variant of '+' (match 1 or more times)
- '??' - non-greedy variant of '?' (match 0 or 1 times)
- '$' - at the end of the expression matches the end of a line (or before newline at the end)
- '( )' - glues expressions in parentheses into one expression and captures a matched substring (see this example to understand how it works)
- '(?: )' - works like "( )", but does not capture a matched substring
Note: "non-greedy" means that it matches the minimum number of times possible.
Zero-width assertions
You can use the following zero-width assertions (these do not match any character, but test whether a condition is true or false):
| Assertion | Meaning |
|---|---|
| \b | Match a word boundary. |
| \B | Match a non-(word boundary). |
| \A | Match only at beginning of string. |
| \Z | Match only at end of string, or before newline at the end. |
| \z | Match only at end of string. |
| (?= ) | Positive look-ahead assertion (for example, 'j(?=ohn)' matches 'j' in word 'john' but not in word 'june'). |
| (?! ) | Negative look-ahead assertion (for example, 'j(?!ohn)' matches 'j' in word 'june' but not in word 'john'). |
| (?<= ) | Positive look-behind assertion (for example, '(?<=joh)n' matches 'n' in word 'john' but not in word 'joan'). |
| (?<! ) | Negative look-behind assertion (for example, '(?<!joh)n' matches 'n' in word 'joan' but not in word 'john'). |
Within character classes "\b" represents backspace rather than a word boundary.
POSIX character classes
You can use the following POSIX character classes:
| Class | Backslash Equivalent | Meaning |
|---|---|---|
| alpha | Alphabetic characters. | |
| alnum | Alphanumeric characters. | |
| ascii | ASCII characters. | |
| cntrl | Control characters. | |
| digit | \d | Decimal digits. |
| graph | Characters that are both printable and visible (a space is printable but not visible). | |
| lower | Lowercase alphabetic characters. | |
| Printable characters (characters that are not control characters). | ||
| punct | Punctuation characters (characters that are not letters, digits, control characters, or space characters). | |
| space | \s | Spacing characters (e.g. space, TAB, formfeed). |
| upper | Uppercase alphabetic characters. | |
| word | \w | Alphanumeric characters plus underscore ("_"). |
| xdigit | Characters that are hexadecimal digits. |
You can negate the character classes by prefixing the class name with a '^'.
Usage: [[:alpha:]] (alphabetic characters), [01[:alpha:]%] (alphabetic characters plus 0, 1, and %), [[:^digit:]] (all characters except decimal digits).
Short forms of some character classes
You can use the following short forms of character classes:
| Class | Meaning |
|---|---|
| \w | Alphanumeric characters plus underscore ("_"). |
| \W | All characters except alphanumeric characters and underscore ("_"). |
| \s | Spacing characters (e.g. space, TAB, formfeed). |
| \S | All characters except spacing characters (e.g. space, TAB, formfeed). |
| \d | Decimal digits. |
| \D | All characters except decimal digits. |
Special characters
You can use the following special characters:
| Special character | Meaning |
|---|---|
| \t | tab |
| \n | newline |
| \r | return |
| \f | formfeed |
| \a | alarm (bell) |
| \b | backspace |
| \x5A | character 'Z' with ordinal 0x5A (hexadecimal value) |
From the Sally manual (GPL-2.0-or-later), © 1997-2023 Open Salamander Authors; © 2025-2026 Elias Bachaalany. Source: manual source (zip) · original page in the Sally repository