View Single Post
Old 10-23-2017, 12:04 PM   #232
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Full-Text Query to Update Custom Column Example

Quote:
Originally Posted by Tanjamuse View Post
In the batch of files that I sent you, sometimes the title of the file in calibre doesn't match with what's in the txt-files (neither does the authors)

Can I edit the title batch so that it matches what's in a specific line in a txt-file?

It's always line #4 for the title and line #6 for the authors.

See the attached. Note that it is not "always" where it should be; just almost always. Also, 2 of the 20 books had no match at all (per the lower left corner statistics), so they have some other nonconformity.


I highly recommend Pythex to prototype and test your regular expressions. MCS always uses RE options Multiline, Ignorecase and Dotall, so you should always activate those options in Pythex (as shown in the image attached below).

Added: you may need to add some special characters to the regular expression to account for Titles that have quotes, semi-colons, periods, etc. So, "^\s+[a-zA-Z0-9 ]+\n" may need to be something like "^\s+[a-zA-Z0-9 ,';"]+\n" and so forth. Regular expressions use odd characters as its control characters, so you may need to "escape" them in your regular expression so it treats them as your characters, and not its control characters. Pythex will tell you when you get it right (or wrong).



DaltonST
Attached Thumbnails
Click image for larger version

Name:	mcs_tanjamuse_answer_line_4_only.jpg
Views:	347
Size:	774.6 KB
ID:	159608  

Last edited by DaltonST; 10-23-2017 at 12:16 PM.
DaltonST is offline   Reply With Quote