View Single Post
Old 05-19-2012, 01: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: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
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