![]() |
#1 |
Zealot
![]() Posts: 115
Karma: 10
Join Date: Jan 2011
Device: none
|
Look ahead & look behind
I've tried to use look ahead & look behind regex's in Sigil Find dialog like:
<p/> <p>(?=[a-z]) or (?<!\.)<p/> but they did not work for me. Also expressions like .*? or \s*? do not seem to work. Is there a way to make them work? I would very much appreciate any help wit this. |
![]() |
![]() |
![]() |
#2 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
0.4.x does not support look ahead or look behind. This is a limitation of QRegExp that Sigil uses. 0.5 (no release date yet) changes to using PCRE and supports look ahead and behind expressions.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() Posts: 115
Karma: 10
Join Date: Jan 2011
Device: none
|
Thanks for the speedy answer, but i was wrong.
I've just manageed to correct all the broken lines with: </p> <p>(?=[a-z]) replaced with nothing. Only somehow this doesn't always work. I had to write, then clear, then write the code again a few times until it eventually did the job. I wander, why is it like that? |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Yeah, I'm pretty sure I've successfully used lookahead/lookbehind too. But overall I find Sigil's regex quite weird, so looking forward to PCRE.
As far as .*? or \s*? goes, the trick seems to be to never use the question mark, and to check the 'minimal matching' checkbox under the regex options - the makes all */+ act as if there is a question mark. |
![]() |
![]() |
![]() |
#5 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
The Road Ahead | borisb | enTourage Archive | 17 | 04-06-2011 09:48 PM |
PRS-950 Infrequent jumps ahead?? | petercreasey | Sony Reader | 4 | 03-26-2011 05:41 PM |
Skipping ahead / Index | LucentBeam | Amazon Kindle | 5 | 10-28-2010 09:08 PM |
Wait or go ahead? | julon2000 | Which one should I buy? | 19 | 03-13-2009 10:13 PM |
went ahead and got a 505 | sigma8 | Which one should I buy? | 0 | 02-26-2009 11:38 AM |