04-10-2024, 09:32 PM | #1 |
Member
Posts: 19
Karma: 10
Join Date: Dec 2016
Device: mobi
|
How to search and replace to put blockquotes inside a div section?
How would I get Caliber to search and replace:
<div>blah-blah-blah</div> with: <div><blockquote>blah-blah-blah</blockquote></div> or even replace it with: <blockquote>blah-blah-blah</blockquote> - - - - - I tried: Regex Search: <div>(.*?)</div> Repalce: <div><blockquote>\1</blockquote></div> But that fails, even though I'm looking at a perfect match just below the cursor. HELP! Thanks. - - - - - Maybe nevermind, I just saw: [ ] Dot all - Make the '.' special character match any character at all, including a newline. Checking that box seems to empower the search, and it found the target. So, case closed... unless anyone else has any additional ideas? Thanks. . Last edited by Peter Blaise; 04-10-2024 at 09:36 PM. |
04-11-2024, 06:02 AM | #2 | |
Zealot
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
|
Quote:
Be aware that your regex won't correctly replace nested divs : <div> something <div>else.</div> Stop.</div> => <div><blockquote> something <div>else.</blockquote></div> Stop.</div> which is incorrect. |
|
04-11-2024, 06:16 AM | #3 |
Resident Curmudgeon
Posts: 74,648
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Are they real <div> or are they <div> that should really be <p>?
|
04-11-2024, 07:13 AM | #4 |
Well trained by Cats
Posts: 29,981
Karma: 56143930
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quit it Jon.
<div> is perfectly valid, just not optimum for a paragraph. Is it really a naked (without class or style) div? Just like the P tag, Blockquote has a default style. You could simply style <div> to have a bigger right/left margin than a normal paragraph. +1 on Diaps toolbag plugin. The Modify mode offers a lot. |
|
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 search problems (NOT Search&Replace; the search bar) | lairdb | Calibre | 3 | 03-15-2017 07:10 PM |
save multiple search/replace, or search/replace multiple ebooks | user743 | Editor | 12 | 04-12-2014 02:38 AM |
Can remove_tags search for div/style value? | tashk | Recipes | 1 | 11-19-2013 10:34 PM |
Hacks PROJECT TO PUT A LIGHT INSIDE KINDLE CASE | vugtitan | Amazon Kindle | 16 | 06-01-2011 12:01 PM |