Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 04-03-2021, 08:18 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Search & Replace: Prepending something in the comments field

I wanted to add a series description to some book comments. So I did this.

Search mode: regex
Search field: comments
Search for: .*
Replace with: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Destination field: comments
Mode: Prepend to field

This resulted in the replacement text appearing multiple times:

Click image for larger version

Name:	2021-04-03 23_26_37.png
Views:	94
Size:	1,022.9 KB
ID:	186373



What did I do wrong?

Last edited by ownedbycats; 04-03-2021 at 10:27 PM.
ownedbycats is online now   Reply With Quote
Old 04-04-2021, 05:07 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
In Python 3 the regexp engine changed. The pattern .* matches both the zero-width 'thing' at the beginning of the line and the entire line. Because there were two matches your string was prepended twice.

Use either ^, which matches before the first character, or .+, which won't do a zero-width match.
chaley is offline   Reply With Quote
Advert
Old 04-04-2021, 05:18 AM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I tested and ^ will work.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search & Replace in multi value field sasilk Library Management 14 03-26-2020 02:15 AM
Search and Replace: want to remove value that matches another field einniv Library Management 0 07-25-2013 08:18 PM
Using Search & Replace with Identifiers field BookJunkieLI Calibre 6 11-13-2012 01:20 PM
Search/Replace from Title Field to Pubdate TMSxMR Library Management 5 08-06-2012 03:40 AM
Variable Search, Replace & Transfer to a new field flopis Library Management 10 03-09-2011 11:41 AM


All times are GMT -4. The time now is 12:35 PM.


MobileRead.com is a privately owned, operated and funded community.