![]() |
#1 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Dec 2010
Device: PRS-650 ... ipad
|
![]()
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. |
![]() |
![]() |
![]() |
#2 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Dec 2010
Device: PRS-650 ... ipad
|
![]()
....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! |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
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. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
css syntax has something called text-transform but I've not messed with it
http://www.w3schools.com/css/pr_text_text-transform.asp |
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Dec 2010
Device: PRS-650 ... ipad
|
![]()
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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,522
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
You can't replace with uppercased-match with regex.
|
![]() |
![]() |
![]() |
#8 |
Junior Member
![]() 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 |
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,688
Karma: 196159104
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. |
![]() |
![]() |
![]() |
#10 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
@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) Code:
\1\u\2 Code:
Chapter ONE Code:
Chapter One EDIT: Found a solution. Search Code:
(Chapter )(.)(.+?\b) Code:
\1\u\2\L\3\E Last edited by Perkin; 03-18-2012 at 06:12 PM. |
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,688
Karma: 196159104
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) Code:
\1\u\2\L\3\E Code:
(Chapter )(\w)(.+?\b)((-)(\w)(.+?\b))? Code:
\1\u\2\L\3\E\5\u\6\L\7\E "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 |
![]() |
![]() |
![]() |
#12 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Great, that also gives everyone a rough idea of how to adapt either version for other uses.
Thanks. |
![]() |
![]() |
![]() |
#13 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,688
Karma: 196159104
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
\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 |
|
![]() |
![]() |
![]() |
Tags |
capital, case, changing, lower |
|
![]() |
||||
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 |