Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-02-2016, 04:54 AM   #1
Hendrixxxxxxxx
Connoisseur
Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.
 
Posts: 67
Karma: 136594
Join Date: Jan 2013
Location: Hong Kong
Device: Kindle DX, Paperwhite, Paperwhite II, and Voyage
Regex question

This may not even be possible, but you don't know until you ask, right?

I am trying to capitalise the first word of every chapter. Easy enough to do manually (just highlight the word and hit the uppercase button, or the keyboard shortcut).

I was wondering if it was possible to do via "Find and Replace". The "find" is no problem, its the "replace" I am struggling with.

Possible, or no?

Phil
Hendrixxxxxxxx is offline   Reply With Quote
Old 01-02-2016, 06:02 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Hendrixxxxxxxx View Post
I was wondering if it was possible to do via "Find and Replace". The "find" is no problem, its the "replace" I am struggling with.
If you've already figured out the find part and captured the first word as \1 you could use something like \U\1\E as the replacement value.

For specific examples, see this old post of mine.
Doitsu is offline   Reply With Quote
Advert
Old 01-02-2016, 06:10 AM   #3
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 875
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
It is possible. See here. Specifically, note: Perl String Features in Regular Expressions and Replacement Texts, although Sigil notation is a little different to Perl.

A simple example. Suppose you had the text:
Code:
<h2>chapter two</h2>
The following search and replace:
Code:
Search = <h2>(.+?)</h2>

Replace = <h2>\u\1</h2>
And the result:
Code:
<h2>Chapter one</h2>
Obviously, you can make it as simple or as complex as you like.

Hope this helps.
sherman is offline   Reply With Quote
Old 01-02-2016, 07:00 AM   #4
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Is this a client's requirement? If not, you might reconsider. This sort of things, like drop capitals, can be attractively decorative on paper, but often looks merely odd on an e-reader screen.
exaltedwombat is offline   Reply With Quote
Old 01-02-2016, 07:15 AM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by exaltedwombat View Post
Is this a client's requirement? If not, you might reconsider. This sort of things, like drop capitals, can be attractively decorative on paper, but often looks merely odd on an e-reader screen.
Drop caps can be relatively easy implemented using pseudo selectors, which are ignored by older readers. I.e., you won't need to implement fallback styles, if you can live with the fact that users of older readers won't see drop caps.
You could for example use ::first-letter to apply drop caps formatting to the first letter of a paragraph or ::first-line to apply small caps to the first line of a paragraph.
Doitsu is offline   Reply With Quote
Advert
Old 01-02-2016, 08:06 AM   #6
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Quote:
Originally Posted by Doitsu View Post
Drop caps can be relatively easy implemented using pseudo selectors, which are ignored by older readers. I.e., you won't need to implement fallback styles, if you can live with the fact that users of older readers won't see drop caps.
You could for example use ::first-letter to apply drop caps formatting to the first letter of a paragraph or ::first-line to apply small caps to the first line of a paragraph.
Indeed. My point was that, even when such text decoration is successfully displayed, it just looks fussy on-screen.
exaltedwombat is offline   Reply With Quote
Old 01-02-2016, 08:19 AM   #7
Hendrixxxxxxxx
Connoisseur
Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.
 
Posts: 67
Karma: 136594
Join Date: Jan 2013
Location: Hong Kong
Device: Kindle DX, Paperwhite, Paperwhite II, and Voyage
Thanks all. I had seen the \U\E somewhere, but couldn't work out how to get it to work in the "replace" box.

That works perfectly - and Doitsu, thanks for the link to your earlier post. I DID search, but I didn't see that one. Appreciate all your help.

Wombat. Appreciate your thoughts. I am capitalising the first word (unless it is a name, in which case it is the whole name), with the first letter full size and the subsequent ones about 80% small-caps. The content, and hence the "feel" I am trying to create, of the book is of one which could have been published at the turn of the last century....to my mind, this achieves this relatively simply and "unfussily". I agree with you though that drop caps (although I have used them) are often a bit much.....

Phil

Last edited by Hendrixxxxxxxx; 01-02-2016 at 08:27 AM. Reason: wordsmithing
Hendrixxxxxxxx is offline   Reply With Quote
Old 01-02-2016, 08:50 AM   #8
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: 28,343
Karma: 203719646
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by exaltedwombat View Post
Indeed. My point was that, even when such text decoration is successfully displayed, it just looks fussy on-screen.
That's just one opinion (unsuccessfully dressed up like a fact). Anybody who gets fussed over a successfully displayed single raised/dropped capital (letter or word) is just looking for things to get fussed over (and can probably easily un-fuss it themselves anyway). There's still a large contingent of readers (the human kind) who actually enjoy a little tasteful artistic expression where ebook layout is concerned. I welcome your "pouring-text-into-a-bucket" analogy with regard to flowing text and "pages," but don't at all welcome it when it gets used as an excuse to homogenize the formatting of all books into one archetypal formula. Blecch! Hope it never comes to pass.
DiapDealer is online now   Reply With Quote
Old 01-02-2016, 11:55 AM   #9
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: 30,889
Karma: 59840450
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 DiapDealer View Post
Blecch! Hope it never comes to pass.

If there was a homogeneous book style, there would be no need for stylesheets.

ONE SIZE FITS ALL

'Pour from a bucket' reminds me of the Load of Manure I order from the farm.

OK for the garden,
But not my reader
theducks is offline   Reply With Quote
Old 01-05-2016, 08:10 PM   #10
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Hendrixxxxxxxx View Post
Thanks all. I had seen the \U\E somewhere, but couldn't work out how to get it to work in the "replace" box.

That works perfectly - and Doitsu, thanks for the link to your earlier post. I DID search, but I didn't see that one. Appreciate all your help.

Wombat. Appreciate your thoughts. I am capitalising the first word (unless it is a name, in which case it is the whole name), with the first letter full size and the subsequent ones about 80% small-caps. The content, and hence the "feel" I am trying to create, of the book is of one which could have been published at the turn of the last century....to my mind, this achieves this relatively simply and "unfussily". I agree with you though that drop caps (although I have used them) are often a bit much.....

Phil
DANGER! DANGER, WILL ROBINSON!!!

Phil, if you are planning on selling that ePUB on B&N, or your client is, I can absolutely promise you that trying to do a full-size cap with smallcaps follow-on lettering will cause you all sorts of agita on a B&N device.

If you use several spans (IOW, more than one) on the first line of a paragraph, in a B&N ePUB, it will either: a) break bizarrely, with strange world hyphenation, mid-word (think...D-og), or b) the first letter will stay where it is supposed to, and the smallcaps remainder will, I kid thee not, align, one letter at a time, vertically on the page, against the left-margin edge. The double-span use breaks the hyphenation rendering engine, and you get weird, weird, WEIRD results. Not one of them works worth a damn.

The Nook rendering engine purely HATES what you are trying to do. If you searched hard enough, you'll find a really old post of mine--what, guys, anyone remember? 2010 or 11? Maybe even 09?--on this very topic.

It's remotely possible that they've fixed it, but whatever you do, test test and test again, if you are planning on Nook distro.

Offered FWIW.

ETA: That thread was here, and I repeated the same issue in 2014, so, as of 2014, it was not fixed: https://www.mobileread.com/forums/sho...d.php?t=232395

Hitch

Last edited by Hitch; 01-05-2016 at 08:18 PM. Reason: Added the thread link and comment.
Hitch is offline   Reply With Quote
Old 01-05-2016, 08:12 PM   #11
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by DiapDealer View Post
That's just one opinion (unsuccessfully dressed up like a fact). <snippage> I welcome your "pouring-text-into-a-bucket" analogy with regard to flowing text and "pages," but don't at all welcome it when it gets used as an excuse to homogenize the formatting of all books into one archetypal formula. Blecch! Hope it never comes to pass.
The "inadequate" guy (did I phrase that that way aloud? Really? Tsk.) would LOVE homogenization!!! You'd be his hero!

Hitch
Hitch is offline   Reply With Quote
Old 01-06-2016, 02:31 AM   #12
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Quote:
Originally Posted by Hitch View Post
a) break bizarrely, with strange world hyphenation
As if the world isn't broken enough these days...
rubeus is offline   Reply With Quote
Old 01-06-2016, 07:35 AM   #13
Hendrixxxxxxxx
Connoisseur
Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.
 
Posts: 67
Karma: 136594
Join Date: Jan 2013
Location: Hong Kong
Device: Kindle DX, Paperwhite, Paperwhite II, and Voyage
Quote:
Originally Posted by Hitch View Post
DANGER! DANGER, WILL ROBINSON!!!
Thanks Hitch. I'll have a look into your past ('09? How old ARE you? ) when I get a few mins. Working on another problem at the moment....

In any event, not selling anything anywhere - its just me trying to learn.

Last edited by Hendrixxxxxxxx; 01-06-2016 at 07:48 AM.
Hendrixxxxxxxx is offline   Reply With Quote
Old 01-06-2016, 01:19 PM   #14
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by rubeus View Post
As if the world isn't broken enough these days...
You know, I think I'll leave it. Just so's you guys always remember that I'm not, actually, infallible.

Quote:
Originally Posted by Hendrixxxxxxxx View Post
Thanks Hitch. I'll have a look into your past ('09? How old ARE you? ) when I get a few mins. Working on another problem at the moment....
Gosh, thanks. As if I didn't already feel decrepit.

Quote:
In any event, not selling anything anywhere - its just me trying to learn.
In that case, go ahead and use it. But, you've been warned that the Adobe rendering engine might eat your text for breakfast! ;-)

Best,
Hitch
Hitch is offline   Reply With Quote
Old 01-06-2016, 07:44 PM   #15
Hendrixxxxxxxx
Connoisseur
Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.Hendrixxxxxxxx knows how many angels can dance on the head of a pin.
 
Posts: 67
Karma: 136594
Join Date: Jan 2013
Location: Hong Kong
Device: Kindle DX, Paperwhite, Paperwhite II, and Voyage
Quote:
Originally Posted by Hitch View Post
:In that case, go ahead and use it. But, you've been warned that the Adobe rendering engine might eat your text for breakfast! ;-)

Best,
Hitch
Noted. Thanks Hitch.

Interesting ADE seems to handle it OK. Must be just a Nook specific thing. I don't have a Nook, so can't test it....but I don't have a Nook so nor do I need to.
Hendrixxxxxxxx is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
regex question DrChiper Editor 14 11-22-2014 04:27 AM
RegEx question (again) phossler Sigil 12 01-20-2013 02:37 PM
A regex question PatNY Sigil 30 06-03-2012 02:03 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


All times are GMT -4. The time now is 09:02 AM.


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