View Single Post
Old 09-30-2015, 12:31 PM   #12
Thom*
The Fumbler
Thom* began at the beginning.
 
Posts: 66
Karma: 10
Join Date: Jun 2015
Device: android 4.2/fbreader
Just search and replace

This is so simple you don't need a plugin to accomplish the task.
The only thing I would change, in order to avoid getting messed up with nested <span> tags, is to change the search string.

Search: <span class="italic">(((?!<span).)*?)</span>
Replace: <i>\1</i>

Consider nested span tags:
<span class="italic">Merry <span class="bold">Christmas </span>Everyone.</span>

Search: <span class="italic">(.*?)</span>
Replace: <i>\1</i>

Would result in:
<i>Merry <span class="bold">Christmas </i>Everyone.</span>


The search/replace that I described does a look-ahead and would not select the span because it has a nested span. You would have to address the "span class="bold" first, then rerun the "span class="italic" to modify it.
Thom* is offline   Reply With Quote