Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-14-2012, 04:35 AM   #1
paulfiera
Addict
paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.
 
paulfiera's Avatar
 
Posts: 378
Karma: 3102
Join Date: Dec 2010
Location: EU
Device: Kobo Aura ONE, Kobo Libra H20
Question Regex help

How can I find and remove all occurrences of the following:

Code:
<a class="calibre7" id="pb-rw_36"></a>
taking into account that the class is always the same but the id is uniqe for each link?

I've been searching the forum and trying different combinations but so far no luck.

Many thanks!
paulfiera is offline   Reply With Quote
Old 06-14-2012, 05:39 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
I suck at regular expressions, but this one should work:

PHP Code:
<class="calibre7" id="(.*?)"></a
Doitsu is offline   Reply With Quote
Advert
Old 06-14-2012, 05:50 AM   #3
paulfiera
Addict
paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.
 
paulfiera's Avatar
 
Posts: 378
Karma: 3102
Join Date: Dec 2010
Location: EU
Device: Kobo Aura ONE, Kobo Libra H20
Quote:
Originally Posted by Doitsu View Post
I suck at regular expressions, but this one should work:

PHP Code:
<class="calibre7" id="(.*?)"></a
Perfect, Doitsu.

It didn't work in Sigil 0.4.2 but worked perfectly in Sigil 0.5.3.

Fantastic.

One more regex to my just started collection.

Many thanks.
paulfiera is offline   Reply With Quote
Old 06-14-2012, 07:43 AM   #4
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
Something I often find quite handy is to clean specific empty tags with a specific attribute (id, class etc).
Code:
<(p|h\d|div|a)\b[^<>]*?(id="blarg")[^<>]*?>([\s\n\r]|&(nb|en|em|thin)sp;|</?br\s*/?>)*</\1>
I cant remember why I use the extra \r\n; but there was a reason... might have just been old QtRegEx
Serpentine is offline   Reply With Quote
Old 06-14-2012, 07:55 AM   #5
paulfiera
Addict
paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.paulfiera could sell banana peel slippers to a Deveel.
 
paulfiera's Avatar
 
Posts: 378
Karma: 3102
Join Date: Dec 2010
Location: EU
Device: Kobo Aura ONE, Kobo Libra H20
Quote:
Originally Posted by Serpentine View Post
Something I often find quite handy is to clean specific empty tags with a specific attribute (id, class etc).
Code:
<(p|h\d|div|a)\b[^<>]*?(id="blarg")[^<>]*?>([\s\n\r]|&(nb|en|em|thin)sp;|</?br\s*/?>)*</\1>
I cant remember why I use the extra \r\n; but there was a reason... might have just been old QtRegEx
Many thanks, Serpentine.

Another one for the collection.
paulfiera is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex Gunnerp245 Conversion 5 03-05-2012 04:15 PM
RegEx el.motar Sigil 10 12-12-2011 05:54 PM
New help with a regex txckie Calibre 2 08-29-2011 08:46 PM
What a regex is Worldwalker Calibre 20 05-10-2010 05:51 AM
Help with a regex A.T.E. Calibre 1 04-05-2010 07:50 AM


All times are GMT -4. The time now is 09:22 AM.


MobileRead.com is a privately owned, operated and funded community.