View Single Post
Old 03-25-2011, 11:55 AM   #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,079
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 bfollowell View Post
I'm having trouble coming up with a regular expression that will work for what I need to do in Sigil. I downloaded a regex cheatsheet and have learned to use some very basic regular expressions but it seems like I run into trouble and have to learn something new every time I try something else.

Here's what I'm wanting to do and what I've tried.
The following string is typical of a chapter subtitle and the first paragraph of a book I'm working on. Most chapters are identical to this except for the actual text of the subtitle.

<p class="chaptersubtitle">An Army of Shadows</p>

<p class="para">

I want to be able to search for this string, regardless of what the actual subtitle text is.

I've tried:

<p class="chaptersubtitle">[rint:]</p>

<p class="calibre1">

and

<p class="chaptersubtitle">[:alnum:]</p>

<p class="calibre1">

but these don't seem to work.

Do any of you regular expression gurus have any ideas?

Any assistance would be greatly appreciated.

Thanks.

- Byron
Code:
<p class="chaptersubtitle">(.+)</p>\s+<p class="para">
Take care with your replace

Code:
<p class="chaptersubtitle">\1</p> <p class="para">
You need to put back or modify all the Search terms. the \1 places the contents of the first ( ).
(I put it all back in my example)

NB Tidy will take care of the newline between the closeing </p> and the next tag
theducks is offline   Reply With Quote