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 01-09-2023, 12:54 AM   #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,936
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Regex search & replace help

I created a regex that successfully captures a string from a longtext column.

However, I'm having trouble using search & replace to copy it to another column. I tried this:

Click image for larger version

Name:	2023-01-09 01_30_38-Editing metadata for one book.png
Views:	145
Size:	48.2 KB
ID:	198908

Instead of just 'M', as expected, it copied the entire contents of the column to #fanficrating, but replaced the matched part with 'M'.

What should I do?

Last edited by ownedbycats; 01-09-2023 at 01:08 AM.
ownedbycats is online now   Reply With Quote
Old 01-09-2023, 01:19 AM   #2
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,936
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
If I enable s (dot matches newline), this works:

https://regex101.com/r/OnUcMr/1

Code:
.*(<p><span class='label'>Rating<\/span>: <div class='metadata' id='rating'>(.*?)<\/div><p>).*
I don't think I can do that in Calibre though.

Last edited by ownedbycats; 01-09-2023 at 01:24 AM. Reason: typo in bbcode
ownedbycats is online now   Reply With Quote
Advert
Old 01-09-2023, 01:24 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,936
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Oh wait I can

Code:
(?s).*(<p><span class='label'>Rating<\/span>: <div class='metadata' id='rating'>(.*?)<\/div><p>).*
Replace with: \2

ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
regex search/replace - how to? Alt68er Sigil 1 03-11-2014 08:53 PM
Regex search and replace dwlamb Sigil 6 04-12-2013 02:34 PM
Regex help: Edit Meta Search & Replace: Pad with zero _noel_ Calibre 4 11-26-2012 04:31 PM
Search & Replace/Regex help!! millertime13 Conversion 4 07-22-2011 02:40 AM


All times are GMT -4. The time now is 01:05 PM.


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