With this JavaScript / JQuery code snippet you’ll be able to dynamically format any type of sign on your website. Here’s an example:
Unformatted:
tristankappel®
Formatted:
tristankappel®
And here’s the snippet the uses regular expressions:
$("body").html( $("body").html() .replace(/((?!<sup>\s*))®((?!\s*<\/sup>))/gi, '<sup style="font-size: 0.7em">®</sup>') // wrap ® if not wrapped yet .replace(/((?!<sup>\s*))®((?!\s*<\/sup>))/gi, '<sup style="font-size: 0.7em">®</sup>') // wrap ® if not wrapped yet );
It will work for any type of sign.
This could also be achieved by a search and replace in the database. But if you want to ensure that every possible future occurrence of a sign like this will be formatted the same way, without forcing your editors to write HTML, this is a good approach until you can do the database search and replace.