Today, 09:59 AM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Mar 2024
Device: none
|
Replace group in Regex function mode
I have the following string:
Code:
<span class="line">Come here, he says.<span aria-label="11" class="page-normal" id="d5e1496" role="doc-pagebreak" title="11" epub:type="pagebreak"></span></span><br /> Search: Code:
<span([^>]*"pagebreak"> ?)</span> Code:
<xxspan\1</xxspan> Code:
<span class="line">Come here, he says.<xxspan aria-label="11" class="page-normal" id="d5e1496" role="doc-pagebreak" title="11" epub:type="pagebreak"></xxspan></span><br /> However, if I add the following in a Regex-function: Code:
return regex.sub('<span([^>]*"pagebreak"> ?)</span>', '<xxspan\1</xxspan>', match.group()) Code:
<span class="line">Come here, he says.<xxspan</xxspan></span><br /> |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to replace text with Search and Replace with regex on Calibre | darrnih | ePub | 2 | 04-02-2024 02:10 AM |
Regex in Regex function mode | lindlind | Editor | 5 | 03-22-2024 03:41 AM |
[Plugin] regex function replace plugin | The_book | Plugins | 19 | 09-23-2022 07:58 AM |
Can we run Function mode in Search & replace during the conversion process? | omin | Conversion | 2 | 02-08-2020 08:53 PM |
Missing "function mode" for editor's Search & Replace | atux | Editor | 3 | 01-17-2016 08:40 AM |