09-25-2017, 12:21 AM | #1 |
Junior Member
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. |
09-25-2017, 01:09 AM | #2 |
Grand Sorcerer
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]+)\) |
09-25-2017, 01:56 AM | #3 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
|
09-25-2017, 05:30 AM | #4 |
Wizard
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. |
09-29-2017, 10:27 AM | #5 |
Junior Member
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? |
09-29-2017, 01:09 PM | #6 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
|
09-29-2017, 03:30 PM | #7 |
Well trained by Cats
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
|
|
09-29-2017, 11:51 PM | #8 |
Junior Member
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! |
|
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 |