![]() |
#1 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: May 2010
Device: iPad
|
![]()
Hi all,
I don't know if I am just doing it wrong but it seems that Sigil currently does not support the selection/capturing of string tokens with a regex to use it later in the Replace/Find dialogue. Is that correct? I tried the Perl syntax with $1, $2, ... and I also tried cap(1), cap(2), ... and capturedTexts()[1], capturedTexts()[2], ... as specified in the QRegExp documentation (QRegExp is obviously the regex implementation used by Sigil, look here for its documentation on capturing variables: http://doc.qt.nokia.com/3.3/qregexp.html#1-5). This would be a very important feature for me as I commonly run across badly converted PDF outputs which need to be fixed. Any ideas? Thanks in advance! |
![]() |
![]() |
![]() |
#2 |
Not who you think I am...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
|
Try \1 \2
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: May 2010
Device: iPad
|
Excellent, that worked!
![]() I suggest putting that in the documentation, maybe other users might find it helpful as well... |
![]() |
![]() |
![]() |
#4 |
DRM remover
![]() Posts: 84
Karma: 10
Join Date: Dec 2009
Location: North of Germany
Device: Kindle 3, 4 & Touch, iPhone/iPad, Hanvon N516 (OpenInkpot)
|
Hi,
I have exactly the same problem but \1 \2 does not work either... I am trying to remove additional brakes: find what: [a-z0-9]<br class="calibre 4" /> replace with: \1 all I get is the character which is found by the first search replaced with "\1", nothing else. using sigil 0.2.3 |
![]() |
![]() |
![]() |
#5 |
Not who you think I am...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
|
You've got to put something in parentheses:
find: ([a-z0-9])<br class-"calibre 4" /> replace: \1 This will find a lower-case letter or number followed by the <br ...> and replace it with whatever the lower-case letter or number is. The <br ...> will disappear. BTW, I'd add a space to the replace -- \1\s -- as changing multiple spaces is easy, but spell checking mis-joined words is not. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
DRM remover
![]() Posts: 84
Karma: 10
Join Date: Dec 2009
Location: North of Germany
Device: Kindle 3, 4 & Touch, iPhone/iPad, Hanvon N516 (OpenInkpot)
|
THANKS! that worked
![]() I googled several pages but nowhere found the tip with the parantheses... one other question, if I search for "a-z" it will find capital letters too. That seems to me not correct or? thanks calvin Last edited by calvin; 07-22-2010 at 07:56 AM. |
![]() |
![]() |
![]() |
#7 | |
Not who you think I am...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
|
Sets of parentheses, from left to right, correspond to the numbers you use in the replace: first set -- \1, second set -- \2, etc.
Quote:
|
|
![]() |
![]() |
![]() |
#8 |
DRM remover
![]() Posts: 84
Karma: 10
Join Date: Dec 2009
Location: North of Germany
Device: Kindle 3, 4 & Touch, iPhone/iPad, Hanvon N516 (OpenInkpot)
|
thanks for your help!
calvin |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
What a regex is | Worldwalker | Calibre | 20 | 05-10-2010 05:51 AM |
Regex help... | Bobthebass | Workshop | 6 | 04-26-2009 03:54 PM |
700 or K2 for highlighting, capturing & take notes + whole family | Douglasco | Which one should I buy? | 7 | 02-25-2009 08:46 AM |
Noob: just getting my head around all the variables | KAM | Sony Reader | 16 | 02-04-2009 06:16 PM |
Entertaining, capturing and inspiring soul teaser | irapas1 | Reading Recommendations | 0 | 10-25-2003 07:15 AM |