Search and Replace¶
Run a search & replace on the page or pages on the prefix. This lets you apply simple changes to the page source. You can choose between string or regexp replacement.
A sequence of search & replace rules on a prefix
In the example above, search & replace is used to extend the list of classes (with a new class
foo) for any element that possesses only the hello-world class.
Using regexp backreferences
The replacement field supports regexp backreferences via the
$n format, as in the screenshot above. The example looks for “Hello World” in the page source, stores backreferences to each letter group and reverses their order, resulting in the output “World hello”.
Refer to the
java.util.regex.Pattern documentation for the details of the supported regular expression format.
Multiple S&R overrides can be added on the same prefix, and they will be applied sequentially. No two replacement strings/regexps may match, the dialog will display an error if you attempt to enter the same replacement rule twice.
- Content-types: a pattern determining what content types the rule will apply to
- Search and Replace: patterns that determine replacements. If Regexp is selected below, capture groups and backreferences may be used.
- Regexp: treat the above patterns as regular expressions, enabling the use of cepture groups and other features.
- Target languages: a pattern that determines which locales the rule will apply to. These patterns are applied to the locale codes (such as
de-DE) and are case-sensitive! Omit to have the pattern apply to all locales.