View Single Post
Old 10-20-2011, 01:21 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,812
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by maartencoertjens View Post
Hi

I am very new to regular expressions but found a lot of useful info here so adding books is much more succesful now. I have however a lot of books that are already in the library and that still have in the title field: title by author> For example The rhyme of the ancient mariner by Coleridge. I have been editing them one by one but got bite tired of that
And therefore am hoping that there is any easy way to do search and replace with regex.

Thanks a lot!

Maarten
It takes 2 passes.
First sets the Author. Second cleans the title of the
by author

the image shows the first setting
Not check the test cases for correctness

for the second pass, change the destination to Title
AND the replace with to \1 (the stuff before the by

View the TEST results carefully. (a full backup of your Library would not be out of order ) before committing.

Doing this wrong
Attached Thumbnails
Click image for larger version

Name:	split on by.jpg
Views:	267
Size:	40.0 KB
ID:	77994  
theducks is offline   Reply With Quote