Search
Other ReReplacer questions
Forum

replace html

Isabel Dömer's Avatar Isabel Dömer
Hello,

I want to render ® characters as "<small><sup>®</sup></small>".
But since "<small><sup>®</sup></small>" already occurs in the content, I would like to leave that untouched. How is that possible?

thank you
Peter van Westen's Avatar Peter van Westen ADMIN
The easiest way is to make 2 replacements.

One to simply replace:
®
With:
<small><sup>®</sup></small>

And then a second to replace any double-replaced ones back. So:
<small><sup><small><sup>®</sup></small></sup></small>
With:
<small><sup>®</sup></small>

Another way is to use Regular Expressions. Depending on how specific you need it, I think it would be enough to ignore any '®' that has a '>' before or a '<' after it.

So you can search for this with the Regular Expressions setting on:
([^>])®([^<])
Replace with:
\1<small><sup>®</sup></small>\2
Please post a rating at the Joomla! Extensions Directory
Isabel Dömer's Avatar Isabel Dömer
Hi Peter,

the regex solution works perfect!! Thank you so much!!!!

Many greetings
Isabel Dömer's Avatar Isabel Dömer
Hello,

I noticed that the solution only affects strings of words where letters/characters follow the ® character, e.g. abc®-01 or abc®5. If the word ends in ®, the global replacement does not apply. How can this be resolved?
I am happy about every answer.
Peter van Westen's Avatar Peter van Westen ADMIN
Another way is to use Regular Expressions. Depending on how specific you need it, I think it would be enough to ignore any '®' that has a '>' before or a '<' after it.
That.

So it will not work on ® characters that have a '<' after it.

Otherwise, try the non-regex solution.
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
Or change the search to:
([^>])®([^<]|$)
Please post a rating at the Joomla! Extensions Directory
Isabel Dömer's Avatar Isabel Dömer
Hi Peter,

this solution is perfect!!!!! Thank you so much!!!

Greetings ;o)
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription