05-10-2014, 12:12 PM | #16 |
Village idiot
Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
I was having trouble with spaces in between tags, e.g
Code:
<p class="P-P27" id="calibre_pb_3"><span class="S-T">1. Title of chapter</span>*</p> I just couldn't match the search on this - it just worked till the </span>, it failed when I tried to include the </p> After some googling, I did this: Code:
<p class="P-P27" id="calibre_pb_3"><span class="S-T">(.+?)</span>\s</p> Code:
<h1>\1</h1> |
05-10-2014, 12:35 PM | #17 | |
Well trained by Cats
Posts: 29,818
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:
use a + if there must be 1 or more |
|
Advert | |
|
05-10-2014, 01:55 PM | #18 |
Village idiot
Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Thank you!
|
05-11-2014, 10:10 AM | #19 |
Junior Member
Posts: 6
Karma: 610
Join Date: Aug 2011
Device: Calibre, FBreader(android)
|
So then "\1" refers to keeping all the digits?
What if my titles are alphabets? eg: One, Two... ? Is there a way to keep my original text then? Ahhh. That's why davidfor said to remove the bold tag. Thanks! |
05-11-2014, 10:46 AM | #20 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
\1 in replace will take the place of whatever regular expression was first in find.
Example Find Chapter (.+?) Replace -CHAPTER \1- Will give you -CHAPTER 1- replacing Chapter 1, -CHAPTER 2- replacing Chapter 2 and so on. What it gives you depends on the regular expression. If it is ([a-z]) it will give you a lower case letter. If it is ([0-9]) it will give you a single number. You can have a series of them and so the second expressions capture would be output by \2. You don't have to use what is found, so you can just use \2 without \1. |
Advert | |
|
05-11-2014, 10:58 AM | #21 | |
Well trained by Cats
Posts: 29,818
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:
https://www.mobileread.com/forums/sho...d.php?t=118569 |
|
05-11-2014, 11:01 AM | #22 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
100% with theducks. There is NOTHING regular about regular expressions, except it regularly gives you headaches. Sigil regex is not the same as calibre regex, which is not the same as .....!
BTW be very careful that if your search expression contains a period, you are not set to regex. Period means something in regex beyond just a period, unless it is prefaced with a \. You will get interesting or hair-tearing results...I know. I have. Last edited by mrmikel; 05-11-2014 at 11:07 AM. |
05-11-2014, 11:52 AM | #23 | |
Well trained by Cats
Posts: 29,818
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:
|
|
05-11-2014, 01:53 PM | #24 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
I didn't know that. I will have to try the shortcut. Save me some steps and headaches.
|
05-13-2014, 05:49 AM | #25 |
Connoisseur
Posts: 59
Karma: 118112
Join Date: Jul 2013
Device: none
|
Thanks, and thanks again, to all who have made comments and extended the original query.
I have found this very useful and instructive. All I need now is the time to experiment. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Invisible chapter headings? | bcamp47 | Sigil | 6 | 03-24-2013 12:38 AM |
How to mark chapter headings | JimLL | Sigil | 107 | 06-17-2012 09:02 AM |
Chapter Headings | Paxman53 | Conversion | 3 | 10-12-2011 12:31 PM |
Why H1 and H2 Chapter Headings? | Ransom | Calibre | 11 | 08-10-2011 04:29 PM |
Help converting chapter headings | p3aul | Conversion | 6 | 04-03-2011 12:56 PM |