Thread: RegEx
View Single Post
Old 12-12-2011, 01:02 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,099
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by el.motar View Post
Hi Bookworms.

I am having a problem with a RE expression and wonder if anyone could shed some light on the problem.

I am trying to replace the div tags with h3 tags around the second headers of a book with lots of those, I think around 198 in total, bit tedious by hand.

The headers are all upper-case and normally one space between words, this is my search string with minimal matching selected.

<p class="western1">([^a-z]+[^¿][A-Z]+[\s].*)</p>

This does select the headers but I can not figure out how to store the test contents of the headers.

I seem to end up with only a part of the header, have tried to include up to 5 round brackets "(" and use the \1 to \5 to replace the contents but not luck.

Would appreciate any help from the experts.

ATB

el.motar
can you paste a complete sample PARAGRAPH for us to see?

does <p class="western1"> appear on any other line?
If so, what is the line just before the 'header"? Is it unique in relation.

As always, do not post more than a few lines of copyrighted material without the authors (included) permission.
theducks is offline   Reply With Quote