![]() |
#1 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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: 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. |
![]() |
![]() |
![]() |
#2 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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>).* ![]() Last edited by ownedbycats; 01-09-2023 at 01:24 AM. Reason: typo in bbcode |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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>).* ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |