|
|
#1 |
|
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Dec 2011
Device: Nook
|
help with a Find regex
here is my html
Code:
<p class="c8">
<span class="c3">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is .</span>
</p>
Code:
/<span[^>]*>(.*?)<\/span>/g if i use a regex tester online it work, https://regex101.com/r/cqkkT1/1 I am trying to find the text within the span, i will eventually remove the span and place the text in the parent p-tag. in calibre it doesnt find the text, "no matches were found". any help? thanks |
|
|
|
|
|
#2 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 32,000
Karma: 65700000
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
K I S S
Use diaps toolbag plugin. It does proper matching of nested opening and closing tags Preferences: Getplugins: Diaps Editing Toolbag |
|
|
|
|
|
#3 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,911
Karma: 9600930
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Ensure you have set the search Mode to Regex.
This might work better... Find... <p class="c8">\s+<span class="c3">(.*?)</span>\s+</p> Replace... <p class="c8">\1</p> Assuming the classes are static. |
|
|
|
|
|
#4 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,244
Karma: 154365101
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
|
|
|
|
|
#5 | |
|
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 195
Karma: 1537710
Join Date: Jul 2021
Device: N/A
|
The correct regex for calibre is :
Code:
<span[^>]*>(.*?)<\/span> The Theducks' suggestion to use the diaps toolbag plugin is excellent, it's very flexible and will take care of the embedded spans. Quote:
For the same reason (and to avoid to overshadow the contents of the web), I don't use google and Cie, not even bare ddg, but ddg with its noAI option : https://noai.duckduckgo.com Last edited by lomkiri; Yesterday at 01:06 PM. |
|
|
|
|
|
|
#6 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,244
Karma: 154365101
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
If there a reason not to use Otter's Editing Toolbag just because it was created using AI? It does work.
|
|
|
|
|
|
#7 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 32,000
Karma: 65700000
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
|
|
|
|
|
#8 | |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 54,940
Karma: 182340541
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Simpler regex searches will work under most implementations however even with those, you may find yourself being bitten on the butt. |
|
|
|
|
|
|
#9 | |
|
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 195
Karma: 1537710
Join Date: Jul 2021
Device: N/A
|
Quote:
Speaking of this precise case : Diap is a good and experienced dev, he knows what is doing –and why– when he writes a group of instructions. He knows which part of the text he will (or should) reach with the code. And afterwards, he knows where may be the flaws and which situations to test. A machine doesn't think (the word AI is a lie, it's just a slogan for those things so people think it's magic, the real name is LLM, Large Language Model), it just makes hundreds of thousands iterations with all the code it has stolen in the internet (mainly in Github and Cie). We have no guaranty that the code is correct, even if it has been tested by humans. An LLM-generated plugin may silently corrupt an epub, or may eat part of sentences or even some paragraphs without any warning, so in theory I should display and check all the changes, at each time I use it, which is not acceptable. When you vibe-codes, you have no control over the code. LLM may be used to create some small parts of simple code that the dev can understand and check and that he will integrate in hiis code. In other words, it may be used as an assistant for small parts of code. The dev is still the master of the code. Even if I'm not in favor of this use for ethical reasons. LLM SHALL NOT be used to create entire softs or plugins, and even more if the author is not a dev.(I don't know if the creator of the Otter plugin is a dev or not). And mainly if there is a risk of data corruption during the use of this soft or plugin. Last edited by lomkiri; Yesterday at 05:56 PM. |
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New to regex find and replace! | ksimpson1986 | Sigil | 2 | 11-06-2016 11:29 AM |
| regex cannot find to replace | eschwartz | Editor | 11 | 02-03-2014 11:00 PM |
| Regex find and replace | SanatyrZeo | Sigil | 5 | 10-29-2012 07:03 AM |
| RegEx find and replace | iblesq | Sigil | 1 | 01-10-2011 09:26 PM |
| REGEX find and replace help please | potestus | Sigil | 13 | 09-18-2010 04:14 PM |