View Single Post
Old 05-19-2012, 02:18 AM   #8
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,984
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Quote:
Originally Posted by bfollowell View Post
I think what I need then is a regex expression that will let me find:

<p class="para c2">“Ignore whatever characters may be in this paragraph.”</p>

and replace it with:

<p class="para"><span class="italic">“Ignore whatever characters may be in this paragraph.”</span></p>

Any suggestions? I'm OK with extremely basic regex but I get lost when trying to build larger expressions that will look for something specific with some random text in the middle and then allow me to replace the exact portion of random text as is.

- Byron
that is easy
find
<p class="para c2">(.*)</p>
replace
<p class="para"><span class="italic">\1</span></p>

but having span in the replace is superfluous
so
replace
<p class="para" "italic">\1 </p>
is neater

PS so in fact why bother - just define class c2 to mean italic & you are done!
cybmole is offline   Reply With Quote