|  01-02-2014, 02:38 PM | #1 | 
| Junior Member  Posts: 2 Karma: 10 Join Date: Dec 2011 Device: Kindle |  How to format regular expression for adding books? 
			
			I am needing to create a regular expression to add new books to my library.  The books are in Series Series-Index Title - Author format.  The expression I am currently using works if all the books have a series, but if it only has the title it does not work. (?P<series>[^_0-9-]*)(?P<series_index>[0-9.2]*)\s*(?P<title>[^_].+) -?\s(?P<author>[^_-]+) How do I get the expression to check if the series is part of the book name? Thanks for any help!! | 
|   |   | 
|  01-07-2014, 08:27 AM | #2 | 
| Fanatic            Posts: 515 Karma: 1470724 Join Date: Jul 2013 Location: Quebec CA Device: android 4 (samsung tablet and asus tablet) | 
			
			I think you need to eyeball them first but what about the metadata title/series/author info?
		 | 
|   |   | 
| Advert | |
|  | 
|  01-07-2014, 09:10 AM | #3 | 
| Junior Member  Posts: 2 Karma: 10 Join Date: Dec 2011 Device: Kindle | 
			
			All of my books are named either Series # Title - Author or Title - Author.  The expression works if the book is in a series but if it is just Title - Author it will pull the last 2 bytes of the Title for the Title and put the rest in the Series.  Is there someway to check if the Series is missing so it will format Title - Author correctly?
		 | 
|   |   | 
|  01-11-2014, 08:05 PM | #4 | 
| Fanatic            Posts: 515 Karma: 1470724 Join Date: Jul 2013 Location: Quebec CA Device: android 4 (samsung tablet and asus tablet) | 
			
			To use the regular expression to parse the title you must manually separate those books with just "author-title" from those with "series index - author - title" and those with "author - title - series index. Have these books got metadata? I find it easier to add books and let the information fields be filled by the metadata imbedded in the book. | 
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Adding books, Regular expression help please | Shadewing | Library Management | 13 | 04-04-2012 05:31 AM | 
| Help in adding books using "regular expression" | DM399 | Calibre | 2 | 07-08-2011 06:38 AM | 
| Adding Books, regular expression | smarties86 | Calibre | 4 | 12-19-2010 08:18 AM | 
| Regular Expression on adding books. | Lokro | Calibre | 4 | 11-06-2010 11:05 AM | 
| Regular Expression For Adding Books | jhart711 | Calibre | 3 | 09-27-2010 06:51 AM |