|
|
#1 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15
Karma: 954
Join Date: Aug 2011
Device: NOOK Simple Touch
|
Replacing multiple tags over 2 lines
Code:
<p class="calibre10"><span class="calibre12 bold">15</span></p>
<p class="calibre2"><span class="calibre4 bold">MAVERICKS</span></p>
Code:
<h1>15<br />
MAVERICKS</h1>
Code:
(Find)<p class="calibre10"><span class="calibre12 bold">(\d\d)</span></p> (Replace with)<h1>\1<br /> |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,095
Karma: 927511
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
|
I think the following might work:
find: Code:
<p class="calibre10"><span class="calibre12 bold">([0-9]{1,})</span></p>\s<p class="calibre2"><span=class="calibre4 bold">([A-Za-z]{1,})</span></p>
Code:
<h1>\1<br />\2</h1>
__________________
Creator and maintainer of the e-Book Tools Word add-in. Creator and maintainer of the Clean HTML macro for MS Word. |
|
|
|
|
Enthusiast
|
|
|
|
#3 | |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15
Karma: 954
Join Date: Aug 2011
Device: NOOK Simple Touch
|
Quote:
Unfortunately that doesn't do it. The first part of the expression matches, but adding the second fails. According to some old docs, Sigil's RegEx engine is very Perl-like. Perl doesn't normally do multi-line matches, but it can be made to do so. I wonder if we must do something special for multi-line matches. |
|
|
|
|
|
|
#4 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 552
Karma: 23783
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300
|
Change Toxaris' find to
Code:
<p class="calibre10"><span class="calibre12 bold">(\d+)</span></p>\s+<p class="calibre2"><span class="calibre4 bold">(.+)</span></p> |
|
|
|
|
|
#5 | |
|
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 532
Karma: 2000170
Join Date: Aug 2010
Location: East Texas
Device: DXG, K3, Jetbook(+Lite), eSlick, Nook, PRS350, PB301+, PB360
|
Quote:
Just trying to figure this regex stuff out. Regards - John |
|
|
|
|
|
|
#6 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,686
Karma: 772746
Join Date: Sep 2010
Device: Sony PRS 650, Kindle for PC
|
i usually use \s* & it works fine .
I think the relevant definitions are: \s+ match one or more spaces \s* match none or more spaces |
|
|
|
|
|
#7 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,095
Karma: 927511
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
|
Forgot the plus sign...
__________________
Creator and maintainer of the e-Book Tools Word add-in. Creator and maintainer of the Clean HTML macro for MS Word. |
|
|
|
|
|
#8 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15
Karma: 954
Join Date: Aug 2011
Device: NOOK Simple Touch
|
That works beautifully.
An hour's work in seconds -- regexes rule! |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Touch Dark lines between lines of text | taming | Kobo Reader | 12 | 06-13-2011 07:20 PM |
| Replacing tags after using them | hiperlink | Recipes | 2 | 03-28-2011 10:23 AM |
| Common tags for multiple librairies | poco06 | Calibre | 5 | 11-19-2010 01:51 AM |
| Multiple Tags | luthar28 | Mobi | 0 | 08-05-2010 10:18 PM |
| Bug: entries with multiple formats trigger multiple conversions | flinx1 | Calibre | 12 | 05-21-2010 06:23 AM |