Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 02-22-2011, 02:52 PM   #1
tscamera
Enthusiast
tscamera began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Dec 2010
Device: PRS-650 ... ipad
Question lower case to capital via regex

hi,
does anybody know, how i can change lower case to capital.
(i mean whole words)
via
regex.


Last edited by tscamera; 02-22-2011 at 03:41 PM.
tscamera is offline   Reply With Quote
Old 02-23-2011, 03:30 AM   #2
tscamera
Enthusiast
tscamera began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Dec 2010
Device: PRS-650 ... ipad
Question coming closer

....while browsing through the regex references i found the search string:

([a-zA-Z])*-

using the hyphen or any other (i.e. space) as the delimiter.

BUT how to replace?

please help!
tscamera is offline   Reply With Quote
Old 02-23-2011, 04:01 AM   #3
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 644
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
I'm pretty sure you cant batch replace with capitals.

Depending on how many need capitalizing, you've got two options.

Loop through each lowercase letter and replace with it's capital
Search 'a' -> Replace 'A'
Search 'b' -> Replace 'B'
etc. (match case)

Or
Copy all the text into a text editor of your choice, select a section that you want capitalized and in menus/toolbar 'Change to UPPERCASE'.
(Will only work if your editor has that ability)

Depending on how much you want changed and a couple of other factors, the Search/Replace will probably be easier, if not monotonous.
Perkin is offline   Reply With Quote
Old 02-23-2011, 05:10 AM   #4
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,793
Karma: 1089170
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
css syntax has something called text-transform but I've not messed with it
http://www.w3schools.com/css/pr_text_text-transform.asp
cybmole is offline   Reply With Quote
Old 02-23-2011, 06:42 AM   #5
tscamera
Enthusiast
tscamera began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Dec 2010
Device: PRS-650 ... ipad
Question in general: is there a way to capitalize (+visversa) with regex?

thanks so far.
but i'm definitly searching for a REGEX solution.
not just for SIGILs find/replace, also for other engines/progs with replace option.
so, in general: is there a way to capitalize (+visversa) with regex?

as i said: ([a-zA-Z])*-
will find whole words ending with a choosen delimiter.
i need the syntax for the replace field.

Last edited by tscamera; 02-23-2011 at 06:47 AM.
tscamera is offline   Reply With Quote
Old 02-23-2011, 07:04 AM   #6
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,147
Karma: 4792399
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by cybmole View Post
css syntax has something called text-transform but I've not messed with it
http://www.w3schools.com/css/pr_text_text-transform.asp
And it's not in the ePUB-supported subset.
Jellby is offline   Reply With Quote
Old 02-23-2011, 09:04 AM   #7
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 644
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
You can't replace with uppercased-match with regex.
Perkin is offline   Reply With Quote
Old 03-18-2012, 04:00 PM   #8
goranjan
Junior Member
goranjan began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Mar 2012
Device: Kindle DX
I think the answer is is Python

I assume you guys are talking about the regex search and replace while doing a conversion.

I am hitting the same problem - except in my case I am matching on text which is in bold, and I want to make it upper case.

If this Search/Replace is based on Python, why can't we use the Python function:

string.upper()

in my case it would be (\1).upper(), since \1 is the match group from my regex.

Thanks,
Goran
goranjan is offline   Reply With Quote
Old 03-18-2012, 04:51 PM   #9
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: 9,032
Karma: 40855212
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
A little over a year later but... with PCRE (that Sigil uses) anyway...

Find: \b(word)\b
Replace with: \U\1\E

Turns "word" into "WORD"

Find: \b(word)\b
Replace with: \u\1

Turns "word" into "Word"

Last edited by DiapDealer; 03-18-2012 at 05:46 PM.
DiapDealer is online now   Reply With Quote
Old 03-18-2012, 05:55 PM   #10
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 644
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
@DiapDealer Nice, but can you also change upper to lower case

e.g Chapter ONE -> Chapter One

If it's lower to upper as wanted in topic we can do
Chapter one -> Chapter One

Search
Code:
(Chapter )(.+?\b)
Replace
Code:
\1\u\2
So what would the replace be for this if possible?
Code:
Chapter ONE
Desired result would be
Code:
Chapter One
(I'd expect same or similar search as above)

EDIT:
Found a solution.

Search
Code:
(Chapter )(.)(.+?\b)
Replace
Code:
\1\u\2\L\3\E

Last edited by Perkin; 03-18-2012 at 06:12 PM.
Perkin is offline   Reply With Quote
Old 03-18-2012, 06:50 PM   #11
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: 9,032
Karma: 40855212
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I see you already discovered a solution while I was typing, so I modified it so it will detect and fix Chapter TWENty-oNE as well.

Code:
(Chapter )(\w)(.+?\b)
Replace:

Code:
\1\u\2\L\3\E
But that won't help when you get as high as "Chapter TWENTY-ONE," soooo.....

Code:
(Chapter )(\w)(.+?\b)((-)(\w)(.+?\b))?
Replace:

Code:
\1\u\2\L\3\E\5\u\6\L\7\E
Should straighten up any capitalization issues of the part that follows "Chapter ", as long as it maintains a standard "word" or "word-word" convention)

"Chapter ONe" will become "Chapter One" and "Chapter THIRTY-two" will become "Chapter Thirty-Two"

Last edited by DiapDealer; 03-19-2012 at 08:35 AM. Reason: Typo
DiapDealer is online now   Reply With Quote
Old 03-18-2012, 09:06 PM   #12
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 644
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
Great, that also gives everyone a rough idea of how to adapt either version for other uses.

Thanks.
Perkin is offline   Reply With Quote
Old 03-18-2012, 10:54 PM   #13
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: 9,032
Karma: 40855212
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Great, that also gives everyone a rough idea of how to adapt either version for other uses.
Just in case it's unclear for any following along:

\u Uppercase the next character
\l Lowercase next character
\U Uppercase until \E
\L Lowercase until \E
\E End case modification

Last edited by DiapDealer; 03-19-2012 at 08:36 AM. Reason: typo
DiapDealer is online now   Reply With Quote
Reply

Tags
capital, case, changing, lower

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I don't like the way calibre sticks with upper-case/capital acolsandra Calibre 6 11-12-2010 11:17 AM
Help With Capital Letter Going Astray Marcy Calibre 3 08-10-2010 11:38 AM
[Bug] Calibre using all lower case path names krunk Calibre 0 05-01-2010 02:58 PM
Hi from the ex capital of culture snickp Introduce Yourself 14 01-30-2009 02:27 PM
Why are Tags all forced to lower case =X= Calibre 2 09-19-2008 02:08 PM


All times are GMT -4. The time now is 10:17 AM.


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