| 
			
			 | 
		#1 | 
| 
			
			
			
			 Enthusiast 
			
			![]() Posts: 43 
				Karma: 10 
				Join Date: Jun 2010 
				
				
				
				Device: Kindle 3 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Need Help With "Regular Expression Syntax"
			 
			
			
			Hey all, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I am seriously confused with Regular Expression Syntax. All of my file names are like this: ---------------------------------------------------------------------------------------- Single Books: Armstrong, Kelley - Jauría Book Series: Armstrong, Kelley - Otherworld 1 - Bitten ---------------------------------------------------------------------------------------- Calibre does not pick up any information at all from these filenames, the title nor the author. Can someone please forward me a syntax that works for this type of file name system?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,465 
				Karma: 10684861 
				Join Date: May 2006 
				
				
				
				Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Armstrong, Kelley - Otherworld 1 - Bitten so I get author name Kelley Armstrong I can extract author, title, series, even make series optional(*), yet I haven't found a way of how to parse (LastName, FirstName|Firstname Lastname) to the {authors} field. (*) I *think*, because I found one unpleasant limitation in python RE engine used to parse names in calibre  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Enthusiast 
			
			![]() Posts: 43 
				Karma: 10 
				Join Date: Jun 2010 
				
				
				
				Device: Kindle 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			see my dilemma??? can anyone give me an expression that most closely extracts the relevant data i need into the metadata card?
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130 
				Karma: 91256 
				Join Date: Feb 2008 
				Location: Germany 
				
				
				Device: Cybook Gen3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			You could always extract the lastname, firstname into {authors} and fix it up with search & replace later. Other than that, off the top of my head, I can't think of any solution.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Enthusiast 
			
			![]() Posts: 43 
				Karma: 10 
				Join Date: Jun 2010 
				
				
				
				Device: Kindle 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			i have literaly thousands of books in that format, we are talking like a month's work of copy and pasting. i have gone over the tutorial with no avail.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130 
				Karma: 91256 
				Join Date: Feb 2008 
				Location: Germany 
				
				
				Device: Cybook Gen3 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Code: 
	(.*?),\s(.*?) Code: 
	\2 \1 Last edited by Manichean; 10-02-2010 at 05:25 PM. Reason: Stupid punctuation after a code block...  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,465 
				Karma: 10684861 
				Join Date: May 2006 
				
				
				
				Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 - When I need to process a few books, I do it manually, with Drag & Drop of the book, then I press E and use icons next to title, name, author to swap some words. - when I have many books to import, especially when they are just files with name of book in a directory that has author name, I make listing of all files (on Linux) it is like Code: 
	cd ~/BooksToProcess find . -type f > copybooks.sh Then I open copybooks.sh in Gvim text editor and I massage it with Regular-Expresion-Fu until I get something like Code: 
	cp '~/BooksToProcess/Armstrong, Kelley/Otherworld/ 1 - Bitten' '~/ImportTempDir/Kelley Armstrong - Otherworld 1 - Bitten' Another solution with the newest Calibre would be to import the books as they are, and then process Authors field using Regular Expressions with backreferences. So: Select books Right click, select Bulk Edit Metadata go to Search and Replace select Search mode Regular Expressions Search for ([^,]*), (.*) Replace expression \2 \1 and, of course select Search Field and Destination Field "authors" DO NOT FORGET TO MAKE BACKUP OF THE LIBRARY BEFORE ATTEMPTING SOMETHING LIKE THIS  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130 
				Karma: 91256 
				Join Date: Feb 2008 
				Location: Germany 
				
				
				Device: Cybook Gen3 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Enthusiast 
			
			![]() Posts: 43 
				Karma: 10 
				Join Date: Jun 2010 
				
				
				
				Device: Kindle 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			wow, i think i'm gonna take a perl programming class at the local community college just so i can figure out a regular expression that works! or just pay a teenager minimum wage to go file by file and input them the way i want. don't know which way would be cheaper yet.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130 
				Karma: 91256 
				Join Date: Feb 2008 
				Location: Germany 
				
				
				Device: Cybook Gen3 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 Enthusiast 
			
			![]() Posts: 43 
				Karma: 10 
				Join Date: Jun 2010 
				
				
				
				Device: Kindle 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			yeah you guys are awesome thanks, i been going over it for hours and hours now. i could've read a few books by now. will continue to try and i'll post back with an update. thanks again, also if anyone does figure it out hit me up.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130 
				Karma: 91256 
				Join Date: Feb 2008 
				Location: Germany 
				
				
				Device: Cybook Gen3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Wait, "if anyone does figure it out"? Both kacir and myself posted solutions to this. I don't think there's anything left to figure out.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 Enthusiast 
			
			![]() Posts: 43 
				Karma: 10 
				Join Date: Jun 2010 
				
				
				
				Device: Kindle 3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			i still can't get the author to load from FN,LN to LN,FN. from what i have gathered i have to go back and redo them with search and replace correct? that is where i am still lost.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			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 | 
| Sigil 024 and regular expressions on "all HTML files" | WS64 | Sigil | 4 | 08-13-2010 08:33 PM | 
| Help with the regular expression | Dysonco | Calibre | 9 | 03-22-2010 11:45 PM | 
| Help: Is there a search expression for "books without Series"? | LARdT | Calibre | 3 | 01-20-2010 10:34 PM |