Regex replace
Replaces every part of the value that matches a regular expression (a search pattern).
Group: Text
When to use it
Section titled “When to use it”Keep the first image of a comma-separated list, reorder parts of a value, remove anything between brackets.
Settings
Section titled “Settings”- Regular expression: the pattern to find.
- Replace with: the new text.
$1,$2… reuse the parts in parentheses,$&the whole match. - Case sensitive: off by default.
Example
Section titled “Example”| Before | After |
|---|---|
a.jpg, b.jpg, c.jpg |
a.jpg (pattern \s*,.*$, replace with nothing) |
10x20 |
20 by 10 (pattern (\d+)x(\d+), replace with $2 by $1) |
Good to know
Section titled “Good to know”- Patterns use the RE2 syntax, which has no lookaround or backreferences. A pattern that is not valid is refused when you save, with the reason.
- For a fixed piece of text, Replacement is simpler.