These are some examples of more complex replacements done with the help of Regular Expressions.

Changing layout of extensions

Let's say you have an extension that outputs an image, then a paragraph of text and then a button. But you want this flipped around. So first the button, then the text, then the image.

In many cases - if the extension is coded well - this can be achieved via template overrides. However this is often quite some work and sometimes not possible.
With ReReplacer you can manipulate the output html in pretty much any way you want.

Ok, so let's take this as the html you find in the html output of your website.

<div class="panel">
    <img src="/path/to/some/image.png" alt="My Image">
    <p>Some text</p>
    <a href="/some/url.html" class="btn">Click here</a>
</div>

And you want this instead:

<div class="panel">
    <a href="/some/url.html" class="btn">Click here</a>
    <p>Some text</p>
    <img src="/path/to/some/image.png" alt="My Image">
</div>

No doing this via a simple text replacement will not work, because the text, image and url of the button are dynamic.

So we can use Regular Expressions.

Search:

(<div class="panel">)\s*(<img [^>]*>)\s*(<p>.*?</p>)\s*(<a [^>]* class="btn">.*?</a>)\s*(</div>)

Replace:

In the search, we are placing the different parts in groups, by surrounding stuff in parentheses (...).
We can then reference the captured text in these groups via \1, \2, \3, etc.
So all we need to do in the replacement is rearrange the order:

\1 \4 \3 \2 \5