Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-29-2013, 03:44 AM   #1
Scott Nielsen
Groupie
Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!
 
Posts: 155
Karma: 112134
Join Date: May 2009
Location: Kuala Lumpur
Device: iPad, K3, K4, T1
Search & Replace

I would like to replace the following lines in an Epub of mine:

<p class="timebreak">&nbsp;<br class="calibre1" /></p>

<p class="timebreak">

with just (for example):

<p class="left">

I'm not having much success so far and I suppose the blank line in the text to be replaced is the cause of it. From a cursory search I gather something called 'marked text' may help me in Sigil but I do not understand how to use it (assuming I didn't completely misunderstood the advice of another thread which, sadly, is quite probable).

Guidance much appreciated.
Scott Nielsen is offline   Reply With Quote
Old 10-29-2013, 04:27 AM   #2
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Make sure you turn on Regex mode:

Click image for larger version

Name:	timebreak.png
Views:	188
Size:	25.6 KB
ID:	114152

Search:
Code:
<p class="timebreak">&nbsp;<br class="calibre1" /></p>\s*<p class="timebreak">
Replace:

Code:
<p class="left">
Or if there are many calibre#s (and not just "calibre1" in that position), you will want to use this Search instead:

Code:
<p class="timebreak">&nbsp;<br class="calibre[0-9]+" /></p>\s*<p class="timebreak">
Red section says look for any "calibre", followed by one or more 0-9. This means it will match "calibre1", "calibre2", .... "calibre99999".

Blue section says look for zero or more "white space".

WARNING: Whenever using Regex, be extremely careful, and DO NOT use "replace all" until you have manually done "Replace" "Replace" "Replace", paying careful attention to make sure everything is working correctly. Save a copy of the EPUB before you go use Regex.
Tex2002ans is offline   Reply With Quote
Advert
Old 10-29-2013, 05:33 AM   #3
Scott Nielsen
Groupie
Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!Scott Nielsen goes to infinity... and beyond!
 
Posts: 155
Karma: 112134
Join Date: May 2009
Location: Kuala Lumpur
Device: iPad, K3, K4, T1
Worked beautifully. Thanks so much.
Scott Nielsen is offline   Reply With Quote
Old 10-29-2013, 08:21 AM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I like the regex way of doing things (\s+) myself. But in case it's awkward for some, simply highlighting the entire code-block, copying, and then pasting into the searchbox is usually sufficient for matching (even in normal mode). It includes the necessary (but invisible) line endings when pasting.

Obviously if you're trying to match multiple, numbered calibre classes, you'll still need some regex regardless.

Last edited by DiapDealer; 10-29-2013 at 08:23 AM.
DiapDealer is offline   Reply With Quote
Old 10-29-2013, 12:10 PM   #5
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by DiapDealer View Post
Obviously if you're trying to match multiple, numbered calibre classes, you'll still need some regex regardless.
I haven't used a Calibre conversion in a WHILE, but last I remembered, it was riddled with lots of calibre### classes. So I just was basing my Regex off of that assumption.

Sometimes people don't post all the information in their examples. Next, they will come back saying:

Quote:
Great, I was able to use that search and replace 255 times!

<p class="timebreak">&nbsp;<br class="calibre1" /></p>\s*<p class="timebreak">

[...]

<p class="timebreak">&nbsp;<br class="calibre255" /></p>\s*<p class="timebreak">
I remember I used to manually look up exactly what each calibre### class did, and then strip it out and/or remove the redundancy in the CSS... one at a time. (Oh, the horrors of my life before Regex)

Last edited by Tex2002ans; 10-29-2013 at 12:13 PM.
Tex2002ans is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
'search & replace' - problem calimero66 Conversion 5 10-23-2012 09:26 AM
Help with a search & replace mmholt Library Management 11 10-21-2011 06:49 PM
Search & Replace :help: krussell Calibre 3 08-02-2011 04:45 PM
Search & Replace/Regex help!! millertime13 Conversion 4 07-22-2011 02:40 AM
Search & Replace Pat Nickholds Sigil 2 10-21-2010 11:18 PM


All times are GMT -4. The time now is 07:51 PM.


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