Quote:
Originally Posted by bfollowell
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