Rewriting & redirecting : Example: Inserting & deleting body text
 
Example: Inserting & deleting body text
Example.com wants to delete some text, and insert other text. As an example, it wants to change:
Hey everyone, this works!
to:
Hey, this works now!
To do this, it will rewrite matching parts of the body in the web server’s response.
The regular expression contains capture groups (.*) that create numbered substrings — back-references such as $0 — that you can recall by their number when writing the replacement text. By omitting a capture group (in this case, $1 is omitted from Replacement), that part of the text is removed. To insert text, simply add it to the replacement text.
Table 44: Example body rewrite using regular expressions
HTTP Body
Regular Expression in URL match condition
(.*)(everyone), (.*)(works)!
Replacement
$0, $2 $3 now!
See also
Regular expression syntax
What are back-references?
Cookbook regular expressions