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, 09: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: 11,361
Karma: 79528341
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:	100
Size:	1,022.9 KB
ID:	186373



What did I do wrong?

Last edited by ownedbycats; 04-03-2021 at 11:27 PM.
ownedbycats is offline   Reply With Quote
Old 04-04-2021, 06: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,525
Karma: 8065948
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, 06: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: 11,361
Karma: 79528341
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I tested and ^ will work.
ownedbycats is offline   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 03:15 AM
Search and Replace: want to remove value that matches another field einniv Library Management 0 07-25-2013 09:18 PM
Using Search & Replace with Identifiers field BookJunkieLI Calibre 6 11-13-2012 02:20 PM
Search/Replace from Title Field to Pubdate TMSxMR Library Management 5 08-06-2012 04:40 AM
Variable Search, Replace & Transfer to a new field flopis Library Management 10 03-09-2011 12:41 PM


All times are GMT -4. The time now is 07:09 PM.


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