View Single Post
Old 09-27-2011, 02:43 PM   #1
Aldebaranian
Junior Member
Aldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheeseAldebaranian can extract oil from cheese
 
Posts: 5
Karma: 1126
Join Date: Sep 2011
Device: none
Metadata Search & Replace - when it doesn't match

Hi all,

I've just started using calibre and very happy with it so far! However I am trying to tidy up my import of a bunch of ebooks acquired over some time and named rather chaotically. I try to do this using the Bulk Metadata function.

I have a fair few files and after importing some of them have been given author names of the form:

Case 1 <author> - <series> - <number>

while others might have

Case 2 <author> - <series>

Now, I wanted to avoid doing things by hand so I planned to use regex replacement to extract the series with an expression of the kind:

Author - ([^-]+) - ([0-9]+)

and then put \1 into series.

That works well for Case 1 above, but not for Case 2 because it places the entire author into \1.

Is there a way to tell calibre that when I do regex search and replace that if the regex _doesn't_ match I do not want anything inserted into the metadata? It seems a reasonable way to operate to me but it doesn't seem to be how it works. Thus I'm probably doing something silly

Thx!
Aldebaranian is offline   Reply With Quote