|
|
#1 |
|
Connoisseur
![]() Posts: 82
Karma: 10
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
|
RegEx question (again)
Mostly a lot of grunt work, but I've come across the following many times, not only in this one but many others. The chapter number is H1, so the TOC just consists of a string of numbers So if I can save the F&R in Tools, I can use it whenever I need it Looks like this .. Code:
<body> <h1>TWO</h1> <p>TITLE OF CHAPTER</p> After manually making changes (lots of trial and error), this seems to work best Code:
<body> <h1>TWO<br /> TITLE OF CHAPTER</h1> or if I could be even more clever Code:
<body> <h1>Two<br /> Title Of Chapter</h1> Paul |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,686
Karma: 772746
Join Date: Sep 2010
Device: Sony PRS 650, Kindle for PC
|
is there an actual question in there, somewhere ?
|
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,707
Karma: 2485850
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
His TOC will look like mush
![]() There needs to be a before the break to prevent: ONETitle of Chapter
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
#4 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,695
Karma: 3644259
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
|
Actually <h1>Two<br /> Title Of Chapter</h1> will likely work just fine.
__________________
Dale DePriest http://pages.suddenlink.net/dalede or http://daledepriest.wikispaces.com currently using an EZ Reader or a Literati or my iPad. |
|
|
|
|
|
#5 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,080
Karma: 2677223
Join Date: Dec 2010
Device: Kindle 3
|
The following quick and dirty regex will replace:
Code:
<h1>TWO</h1> <p>TITLE OF CHAPTER</p> Code:
<h1 title="TITLE OF CHAPTER">TWO<br /> TITLE OF CHAPTER</h1> Replace: <h1 title="\2">\1<br />\n\2</h1> It's not perfect, but should save you some editing. (Sigil uses the title attribute for the toc.) |
|
|
|
|
|
#6 |
|
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 91
Karma: 8474
Join Date: Mar 2008
Location: Berlin, Germany
Device: PRS-T1, PB602, CyBook Gen3
|
I have a solution that is nearly the same as Doitsu, but also starts with the upper case to lower case conversion.
search for: Code:
<h1>(.)(.*?)</h1>\s+<p>(.)(.*?)</p> Code:
<h1>\1\L\2\E<br /> \3\L\4\E</h1> Code:
<h1>TWO</h1> <p>TITLE OF CHAPTER</p> Code:
<h1>Two<br /> Title of chapter</h1> |
|
|
|
|
|
#7 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,707
Karma: 2485850
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
Code:
Two Title of Chapter
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
|
#8 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Just for the record:
Code:
<h1>TWO<br /> Chapter Title</h1>
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." Last edited by ElMiko; 01-20-2013 at 12:17 PM. |
|
|
|
|
|
#9 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,707
Karma: 2485850
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
|
#10 |
|
Connoisseur
![]() Posts: 82
Karma: 10
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
|
Thanks to everyone for taking time to offer comments and make suggestions
Based on what I learned, I did change what I thought I wanted to do I know it's not perfect, but this is what I ended up with Find: Code:
<h1>(.)(.*?)</h1>\s+<p>(.)(.*?)</p> Code:
<h1 title="\1\2 – \3\4">\1\2<br />\3\4</h1> Thanks again Paul |
|
|
|
|
|
#11 | ||
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,823
Karma: 23146860
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
|
Probably all depend on your Clean Source Settings. If it's turned completely off and your code starts life as one line:
Code:
<h2>Chapter One<br />The Title</h2> Quote:
Code:
<h2>Chapter One<br />The Title</h2> Code:
<h2>Chapter One<br /> The Title</h2> Quote:
__________________
“Politics: A strife of interests masquerading as a contest of principles. The conduct of public affairs for private advantage.” Last edited by DiapDealer; 01-20-2013 at 01:22 PM. |
||
|
|
|
|
|
#12 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
EDIT:
Refer to DD's post
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." Last edited by ElMiko; 01-20-2013 at 01:14 PM. |
|
|
|
|
|
#13 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,707
Karma: 2485850
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
I have Pretty Print ON, so maybe I just started doing this with an older version and did not change (and no harm seems to be done, so I never noticed )
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A regex question | PatNY | Sigil | 30 | 06-03-2012 02:03 PM |
| Quick Regex Question | cptsmidge | Sigil | 6 | 03-06-2012 04:20 AM |
| Yet another regex question | Jabby | Sigil | 8 | 01-30-2012 08:41 PM |
| Regex question and maybe some help | crutledge | Sigil | 9 | 03-10-2011 04:37 PM |
| Regex Question | Archon | Conversion | 11 | 02-05-2011 10:13 AM |