![]() |
#16 |
Member
![]() Posts: 13
Karma: 10
Join Date: Jun 2012
Location: UK
Device: Kindle
|
Thanks to both you guys for your help, maybe I ought to read the manual...
David. |
![]() |
![]() |
![]() |
#17 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30
Karma: 752
Join Date: Nov 2010
Device: PB360
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 519
Karma: 2693434
Join Date: Dec 2009
Location: Australia
Device: Cybook Gen 3, Pocketbook 902, Sony 650
|
You don't need to use regular expressions at all, there is a much simpler way
1. For example, to change "of" to "Of" 2. Select the books you want to alter 3. Select Edit Metadata 4. At the top of the Edit Metadata box, select Search and Replace 5. Tick the Case Sensitive box 6. In the Search Field box, tick "title" (not "title search" 7. In the Search for box, type (blank)of(blank) - don't forget the leading and trailing blank spaces 8. In the Replace with box, type (blank)Of(blank) - don't forget the leading and trailing blank spaces 9. Check the Test result box to see it's OK 10. Click OK 11. Then do the same with each relevant word, eg a, the, an, of, and, etc 12 It should take 5 minutes to do the lot, no matter how big your library is |
![]() |
![]() |
![]() |
#19 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,897
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
|
![]() |
![]() |
![]() |
#20 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 519
Karma: 2693434
Join Date: Dec 2009
Location: Australia
Device: Cybook Gen 3, Pocketbook 902, Sony 650
|
It has the same number of steps, is much easier to understand (and type), targets the changes more precisely, and doesn't require checking each book for the undesired u/c to l/c changes that chaley adverted to.
|
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Member
![]() Posts: 13
Karma: 10
Join Date: Jun 2012
Location: UK
Device: Kindle
|
I appreciate all the help provided to me with the question I asked and both methods work well. I am only just getting to grips with Calibre which it is a fine program, hopefully I will be able to sort out my own queries soon... as usual the answer is always RTFM stupid
![]() Thanks again, David. |
![]() |
![]() |
![]() |
#22 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
However, there are some advantages to your approach, specifically the avoidance of unintended changes. Using it in a variation of the regexp method will eliminate the time penalty, the multi-step problem, and the leading/trailing word problem. One is still required to manually scan the titles to build a correct list of words. For example, you could use the following Code:
((?<= )|^)(a|an|the|in|is|by)(?= |$) The components of the regular expression are: * ((?<= )|^) - This is the most complicated part of the expression. It says that whatever follows must be preceded by either a space or the beginning of the title. The part "(?<= )" means look backwards for a space but don't include it in the matched text. The "|" is an "or", so "(?<= )|^)" means "check for a space or beginning of line". * (a|an|the|in|is|by) - this is the list of words to be changed, separated from each other by "or". Add as many words as you wish. * (?= |$) - Check that the word is followed by a space or the end of the title, but do not include the space (if any) in the matched text. Not including the space in this match permits it to be matched again when checking the next word. |
|
![]() |
![]() |
![]() |
#23 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 519
Karma: 2693434
Join Date: Dec 2009
Location: Australia
Device: Cybook Gen 3, Pocketbook 902, Sony 650
|
Quote:
I note your changes; but do you still have the major time penalty of having to check each of the 1500 book titles afterwards to catch the unintended "unCapitalizations"? If you are able to fix this, then your proposal would become more practical. PS I'm sorry if the above sounds a bit grumpy, it wasn't meant to be. I personally have been impressed by and grateful for the work you've done on these forums - especially getting the books on to my 650 in a comprehensible order! I just think this proposal is not practical if you still have to check every book afterwords to find and manually correct the unintended changes. Last edited by Jozawun; 06-07-2012 at 04:58 PM. Reason: Adding PS |
|
![]() |
![]() |
![]() |
#24 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
![]() |
![]() |
![]() |
#25 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 519
Karma: 2693434
Join Date: Dec 2009
Location: Australia
Device: Cybook Gen 3, Pocketbook 902, Sony 650
|
Quote:
But I thought you said of yours "- Uppercase letters in the middle of strings will be changed to lowercase. For example, IBM will become Ibm and iTunes will become Itunes. There are ways around this problem but the regular expression will become more complex than I want to deal with." But if you fixed this major problem, I apologise. |
|
![]() |
![]() |
![]() |
#26 |
Member
![]() Posts: 13
Karma: 10
Join Date: Jun 2012
Location: UK
Device: Kindle
|
Oooer, I didn't want to make this a fight but I will say that using the first regular expression that Charles gave me i.e. "(.*?)( |$)" replace with "\1\2" did change Agatha Christie's 'The ABC Murders' to 'The Abc Murders' - I haven't yet tried the latest version you sent ; "((?<= )|^)(a|an|the|in|is|by)(?= |$)" replace with "\2" so I don't know if that does the same... I shall try it and see.
Thanks again guys, David. |
![]() |
![]() |
![]() |
#27 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You might want to try the regexp "((?<= )|^)([a-z]+)(?= |$)" (without the quotes) instead of the longer one containing the list of words. This new one will capitalize words containing only lower-case letters, eliminating the manual scan for words that must be capitalized. However, the words must contain only the letters a through z, so it won't capitalize words containing non-English letters such as é or ñ. |
|
![]() |
![]() |
![]() |
#28 |
Member
![]() Posts: 13
Karma: 10
Join Date: Jun 2012
Location: UK
Device: Kindle
|
Thanks Charles, my request is certainly turning into a saga but I am grateful for everyone's help. I don't want to labour the point but getting back to 'The A.B.C. Murders', is there a way of capturing a string like A.b.c. and capitalising that. I am now only asking out of curiosity (not necessity) as I am keen to get to grips with regular expression searches so please don't feel compelled to drag this thread on any longer as my initial request is essentially solved.
David |
![]() |
![]() |
![]() |
#29 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
iTunes is not built by IBM or by Alcatel-lucent but by apple with a.b.c results iniTunes Is Not Built By IBM Or By Alcatel-Lucent But By Apple With A.B.C The change to the regexp is to enlarge the set of characters that must precede and follow a word to permit it to be a candidate for capitalization.And you are welcome. Edit: the following regexp is better, changing the alternation ("or") to a character class. I think it is easier to read. "((?<=[ \.-])|^)([a-z]+)(?=[ \.-]|$)" Last edited by chaley; 06-08-2012 at 04:20 AM. Reason: Add another variant |
|
![]() |
![]() |
![]() |
#30 |
Member
![]() Posts: 13
Karma: 10
Join Date: Jun 2012
Location: UK
Device: Kindle
|
Mmmmm, I've read the section in the Calibre manual 'All about using regular expressions' and I think it's going to take a while for me to get a handle on it, I suppose experimentation is the order of the day but only on a copy of my library
![]() David. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Better Book Titles... | Coops | General Discussions | 4 | 05-05-2011 01:52 AM |
Book titles are different | barth90 | Calibre | 10 | 05-18-2010 05:41 PM |
Series and Book Titles | jjansen | Calibre | 10 | 04-14-2010 12:14 PM |
Unutterably Silly Book Titles We Would Like To See | RWood | Lounge | 8 | 02-16-2009 11:57 AM |
Book Titles | dhbailey | Sony Reader | 7 | 03-12-2007 12:07 PM |