![]() |
#1 |
Enthusiast
![]() Posts: 41
Karma: 10
Join Date: Mar 2008
Device: Sony PRS-T1
|
Find / replace
Hello, I'm very new to regex. Could I please receive some help with the following within sigil:
<span class="sgc-7">trying</span> to <i>trying</i> What would I type in find/replace? I tried Find: <span class="sgc-7">(.*)</span> Replace:<i>(.*)</i) but did not work. THanks for any help ![]() |
![]() |
![]() |
![]() |
#2 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Try this:
Search: <span class=\"sgc-7\">(.*)</span> Replace: <i>\1</i> |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 41
Karma: 10
Join Date: Mar 2008
Device: Sony PRS-T1
|
Thanks Harry, tried it - but it has only replaced the first tag, not the second. e.g.
<span class="sgc-7">trying</span> becomes <i>trying</span> Also it only replaces one instance when I click on Replace All . . . the sgc-23 tag occurs around 230 times in the html file. More help much appreciate! Last edited by bremler; 12-14-2010 at 06:17 AM. |
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() Posts: 41
Karma: 10
Join Date: Mar 2008
Device: Sony PRS-T1
|
Got it! Clicked in 'minimal matching' and that did the track. Thanks so much :-))
|
![]() |
![]() |
![]() |
#5 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
The reason for this is that, without the "minimal matching", the "(.*)" search will include the closing tag (in fact, it will include the whole text of the file from that point onwards. That's also why it was only finding the first instance, of course.), hence it's not being replaced. With the "minimal match", it will stop when it reaches text that matches that specified after the wildcard bit.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 9
Karma: 10
Join Date: Dec 2010
Device: Nook
|
10-22-2010, 02:53 PM #5
HamsterRage Addict Posts: 361 Karma: 18008 Join Date: Jun 2010 Device: Kobo "You can strip that stuff out with Sigil. It takes about 10 seconds." I have search in Calibre, google and this forum for a very common problem about removing the spam "generated by ABC AMBER Lit converter blah blah blah" from my ebooks. The solutions doesn't always work or create more problems. Now the comment above sounds promising but didn't offer any instructions. Can anyone please help me here. I have spent hours and I am almost at resigned to reading this crap into the ebooks. Thanks! |
![]() |
![]() |
![]() |
#7 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 114
Karma: 5246
Join Date: Jul 2010
Device: none
|
(IMHO, it's better to start a new topic and post an example of the text you want to replace).
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Grep Find & Replace | Fabe | Sigil | 3 | 12-06-2010 12:00 PM |
REGEX find and replace help please | potestus | Sigil | 13 | 09-18-2010 04:14 PM |
find and replace, epub | ampsonic | Reading and Management | 3 | 03-02-2010 03:20 AM |
Crashes on find / replace all | mr ploppy | Sigil | 1 | 02-03-2010 12:35 PM |
Using Find/Replace with BD | Otter | Sony Reader | 7 | 02-28-2009 01:49 PM |