![]() |
#1 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 130
Karma: 7587966
Join Date: Oct 2010
Location: Mexico
Device: Black Sony Touch (650)
|
Another help with regular expressions
Well, following Starsons advice in another thread [use regexp to get info from the file name], I'm close to get the authors listed by <last-name, first-name>.
I found that the default regexp, found in the "Preferences ->Adding Books" menu is almost what I need. Code:
(?P<title>.+) - (?P<author>[^_]+) However, I would like to get author="Asimov, Isaac". Now, AFAIK regexps are for pattern matching, not for string processing. So, my question is if there is a way to get that extra comma between the last name and the first name. |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() in the Adding books preference |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,720
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@theducks - that won't directly do what they want. They don't want to swap first and last name, they just want a comma inserted. So "Asimov Isaac" becomes "Asimov, Isaac".
Other than changing it manually or using search/replace, your other option is to do a metadata download with the authors box checked. This should overwrite the author in the format you prefer. |
![]() |
![]() |
![]() |
#4 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 130
Karma: 7587966
Join Date: Oct 2010
Location: Mexico
Device: Black Sony Touch (650)
|
Yes, that is exactly what I want. I was hoping there was some kind of replace function added to the basic regexp processing.
|
![]() |
![]() |
![]() |
#5 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,720
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
No there isn't (in the adding process - you can do it post process but that would be messy). If you want such functionality, the best way would be to use a bulk renaming tool outside of Calibre to insert the comma.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 130
Karma: 7587966
Join Date: Oct 2010
Location: Mexico
Device: Black Sony Touch (650)
|
Finally, following the advices given by the fine patrons of this sub-forum, I got what I wanted, see the authors listed as <LN, FN> and sorted by LN.
In case somebody else wants to do the same, this was my procedure: 1. Using the free Bulk Rename Utility (just google it), I renamed the file to "title - lastname, firstname.epub" 2. Open Calibre. 3. In menu "Preferences->Tweak->Author sort name algorithm" I put author_sort_copy_method = 'copy' 4. In menu "Preferences->Adding books" I unchecked all three options and I left the default regular expression alone. 5. Close and open Calibre. 6. Add the books to Calibre library and voila! Thanks to all |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with regular expressions | jevonbrady | Library Management | 6 | 06-21-2011 10:16 AM |
An introduction to regular expressions | Manichean | Conversion | 0 | 01-26-2011 05:05 PM |
Help with Regular Expressions | ghostyjack | Workshop | 2 | 01-08-2010 11:04 AM |
Regular Expressions help needed | Phil_C | Workshop | 20 | 10-03-2009 12:14 AM |
BookDesigner v5 and regular expressions | ShineOn | Sony Reader | 11 | 08-25-2008 04:06 PM |