View Single Post
Old 03-24-2014, 07:01 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
That would go wrong if there are digits in the original tags. Just a question, why do you want to replace <i> by <em>? Both work perfectly fine and although <i> is officially deprecated, I don't think there is a change it will be gone for long. Not only that, there is a distinct difference between <i> and <em>. The first is a stylish indication, the second one semantic. It might be that emphasis is the wrong semantic value for the <i>.
Anyway, back to your question.

If you want to retain the <i> you can just replace <i class="calibre2"> by <i>. If not, you can try to do the following:
Search: <i class="calibre2">(.*?)</i>
Replace: <em>\1</em>

Explanation: the . selects any character. The * says 0 or more and the question mark says 0 or 1.

Regex can be confusing in the beginning, but is worth the time you need to invest. There are various helpers out there. Some here have good results with RegEx Buddy. You can also use a cheatsheet like this one: http://www.cheatography.com/davechil...r-expressions/
Toxaris is offline   Reply With Quote