View Single Post
Old 10-09-2012, 10:10 AM   #1
ghostyjack
Guru
ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.
 
ghostyjack's Avatar
 
Posts: 714
Karma: 1085604
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
Regex problem: Trying to replace surrounding text without effecting the middle

I'm trying to change the formatting on a book I'm working on.

At the beginning of each chapter, there is a chapter number, followed by a heading that is unique to each chapter. Underneath the heading is the start of the actual text.

The problem I have is that the text currently begins with <p> and I want to change it to <p class="newscene2">.

As this book as over 300 chapters, I didn't want to have to manually change each one. So what I want to do is to be able to search for for both the heading and the next <p> irespective of the content of the heading line and then replace the <p> with my new tag, but leave the content between intact.

I've found that:

Code:
<p class="heading">.+</p>

  <p>
will locate each entry, but I can't fathom the replace command. I've tried:

Code:
<p class="heading">.+</p>

  <p class="newscene2">
but all it does is replace all the content with .+ and not leave all the text alone.

So what am I doing wrong?
ghostyjack is offline   Reply With Quote