There are cases where you might need to limit the multiple replacements that SiteSpect would do to a specific section of page source
Let's say you have a page that looks like:
<img class="someclass" src="/path2">
And you want to add a class to the images that are within the contentWrapper div. Regex can be used to limit the scope of search and replace by using look aheads - one negative and one positive.
Consider a search
<img(?!.*<div id="contentWrapper">)(?=.*<div id="new")
which effectively says match on the <img string while <div id="contentWrapper"> is not after and <div id="new" is after.
So the replace might be
but it will be limited to the two img tags in the contentWrapper div