View Single Post
Old 02-14-2014, 10:07 AM   #1
wladdy
Enthusiast
wladdy began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
Search and replace returns entire field when no match is found

A bunch of books titles contain either the title followd by the publication year (eg: "The shining (1977)") or the title by itself (eg: "Carrie").

To isolate all years and move them into pubdate, I search for the following regex in the title field (let's assume no parenthesis in the book titles per se) :

.* \((\d{4})\)

Although \1 returns "1977" for the first example, it also returns "Carrie" for the second, despite there being no match.

Granted, I can work around this by this first selecting the books whose title contains parentheses. However, I would like to understand better how Calibre's search and replace feature works with regexes.

Therefore, my question is: can I tell Calibre to return nothing instead of everything when no match is found.

Thank you!
wladdy is offline   Reply With Quote