08-16-2010, 03:49 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Aug 2010
Device: Nuvi
|
Need Help Creating a Regular Expression
Please forgive my level of competency here, but I have tried and tried and am lost. I am attempting to import my years-old collection of .pdf e-books and need to create a Regular Expression so that Calibre will properly import and map fields. I have about 3,000 e-books in the following format:
Star Wars - [Boba Fett 01] - The Fight to Survive (by Terry Bisson).pdf The Output I would like in Calibre would be: Book Title: The Fight to Survive Author: Terry Bisson Series: Star Wars - Boba Fett and then the #1 for the sequence in the series. Is this possible via a Regular Expression? |
08-16-2010, 07:53 AM | #2 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Should be possible. Take a look at the preferences, specifically the add/save books- page, which links to a handy reference for regular expressions as well as offering a test input thingy. You should be good from there.
|
Advert | |
|
08-16-2010, 09:02 AM | #3 |
Grand Sorcerer
Posts: 12,038
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I can get close, but not perfect.
Testing using the file name you supplied Code:
Star Wars - [Boba Fett 01] - The Fight to Survive (by Terry Bisson).pdf Code:
(?P<series>(.+?))(?P<series_index>\d+)\] - (?P<title>.+) \(by (?P<author>.+)\) I see two ways to deal with the extra '['. The first is to rename the files before importing to calibre. I would generate a text file containing all the book names, then edit that file to create a batch/shell script to rename the books. stripping away the leading '['. If the batch operation isn't something you want to try, then I would run the import, then use the 'manage series' dialog available from the tag browser to manually remove the '[' character from each series. Manually correcting the series this way shouldn't take too long, around 1 to 2 seconds per series. See the attached screenshot to see the regexp in action. |
08-16-2010, 12:41 PM | #4 |
Junior Member
Posts: 3
Karma: 10
Join Date: Aug 2010
Device: Nuvi
|
Brilliant and my most sincere thanks! I will try this after work today.
|
08-16-2010, 03:38 PM | #5 |
Connoisseur
Posts: 95
Karma: 8282
Join Date: Jan 2010
Device: Kindle PW, Kobo Aura HD, Galaxy Note 10.1
|
If you want to do a lot of batch file-renaming before importing into Calibre, look long and hard at the Name It Your Own Way tool.
That tool has saved me hours of time. |
Advert | |
|
08-16-2010, 03:57 PM | #6 | |
Grand Sorcerer
Posts: 12,038
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The tool is at http://www.niyow.com/. |
|
08-17-2010, 01:57 AM | #7 |
Junior Member
Posts: 3
Karma: 10
Join Date: Aug 2010
Device: Nuvi
|
I'm on a Mac so Terminal is great so long as I get the commands right. Else, this is a great GUI on OSX: http://manytricks.com/namemangler/.
Those Regular Expressions worked perfectly for my files, by the way. Thank you again! |
08-17-2010, 10:31 AM | #8 | |
Banned
Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
|
Quote:
I hate software that will not tell you how much it costs unless you install it on your PC. I see no link on the site where you can see the cost or buy it. They don't even tell you it is shareware but I inferred it by the "download free" label. |
|
08-17-2010, 10:41 AM | #9 |
Grand Sorcerer
Posts: 12,038
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
08-18-2010, 02:20 PM | #10 |
Enthusiast
Posts: 38
Karma: 412
Join Date: Sep 2009
Device: WinMobile, Hanvon N516 w. OpenInkPot, eLyricon EBX-500, Iphone 3GS
|
try this Tool for renaming:
http://www.joejoesoft.com/cms/showpage.php?cid=108 It can do regex and is extremly flexible - and its free. |
Tags |
import, regular expression |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regular Expression Help | Azhad | Calibre | 86 | 09-27-2011 03:37 PM |
Regular Expression Help | smartmart | Calibre | 5 | 10-17-2010 06:19 AM |
Help!! Having trouble with regular expression | Partzz | Calibre | 2 | 09-14-2010 01:32 PM |
Regular Expression Help Needed | dloyer4 | Calibre | 1 | 07-25-2010 11:37 PM |
Help with the regular expression | Dysonco | Calibre | 9 | 03-22-2010 11:45 PM |