Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 09-25-2017, 12:21 AM   #1
LeftOvers
Junior Member
LeftOvers began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2017
Device: iPhone
Search & Replace Same Content with Style

I want to boldface and superscript a numbering system in a book that goes like this:

(1:1)
(1:2)
(1:3)

I also want to remove the parenthesis, as well. I've tried this:

Find: ([0-9]+:[0-9]+)

Replace: <b><sup>\1</b></sup>

But that doesn't grab the parenthesis in the numbering as well. I'm stumped. It seems like an easy thing, but for the non-technical user, not so clear. Please help.
LeftOvers is offline   Reply With Quote
Old 09-25-2017, 01:09 AM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I think you need:

Code:
\(([0-9]+:[0-9]+)\)
That will match the parentheses, but not include them in the group.
davidfor is offline   Reply With Quote
Old 09-25-2017, 01:56 AM   #3
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
Quote:
Originally Posted by davidfor View Post
I think you need:

Code:
\(([0-9]+:[0-9]+)\)
That will match the parentheses, but not include them in the group.
And replace:

Code:
<sup><b>\1</b></sup>
jbacelar is offline   Reply With Quote
Old 09-25-2017, 05:30 AM   #4
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
Parentheses are a special character in Regular Expressions, so if you want to actually find them in the text, you have to remember to "escape" them by using a backslash.

If you look at davidfor's answer, you can see the correct backslashes in ORANGE:

\(([0-9]+:[0-9]+)\)

... and the reason why parentheses are special in Regex is your inner portion. Parentheses allow you to "capture" text.

\(([0-9]+:[0-9]+)\)

Whatever is in between those special RED parentheses gets "captured" in a group. So, in this case, all the BLUE stuff becomes "Group 1".

Now, if you take a look at your Replace:

<b><sup>\1</b></sup>

The BLUE "\1" says "stick Group 1" here.
Tex2002ans is offline   Reply With Quote
Old 09-29-2017, 10:27 AM   #5
LeftOvers
Junior Member
LeftOvers began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2017
Device: iPhone
You guys are brilliant. That would have taken me forever to figure out. I tried it and it works. Thanks!

One more question and I think I am good with this project.

I am trying to put a page break before each chapter so that
Chapter 1, Chapter 2, Chapter 3, etc.
all begin on a fresh page at the top of the page in the epub reader on my device.

I tried
<div style=”page-break-before:always;”></div>

That doesn't seem to work.

I noticed a page break option in the "Structure Detection" of the Convert Books. But it doesn't seem to work, or I am doing it all wrong.

Each of my Chapters is styled with H2 and part of the TOC.

Ideas?
LeftOvers is offline   Reply With Quote
Old 09-29-2017, 01:09 PM   #6
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
Quote:
Originally Posted by LeftOvers View Post
I am trying to put a page break before each chapter so that
Chapter 1, Chapter 2, Chapter 3, etc.
all begin on a fresh page at the top of the page in the epub reader on my device.
Ideas?
The safest (never fails):
Each chapter a file.
jbacelar is offline   Reply With Quote
Old 09-29-2017, 03:30 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by jbacelar View Post
The safest (never fails):
Each chapter a file.

and the performance on older devices is great.

The editor can search across many files, so that is not a great reason to keep huge files (sections)
theducks is offline   Reply With Quote
Old 09-29-2017, 11:51 PM   #8
LeftOvers
Junior Member
LeftOvers began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2017
Device: iPhone
Thanks for the idea of splitting the book up into files. I think I stumbled onto the solution. I took out:

<p class="softbreak">*</p>

And replaced it with:

<br></br>
<div style="page-break-before:always;"></div>

And all the chapters start cleanly in my epub app (Marvin) at the top my device. Done!
LeftOvers is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search & Replace changes in 3.0 Phssthpok Editor 4 06-21-2017 04:04 AM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
Search & Replace Help paulfiera Conversion 7 08-06-2015 03:52 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


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


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