Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 04-10-2024, 09:32 PM   #1
Peter Blaise
Member
Peter Blaise began at the beginning.
 
Posts: 11
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.
Peter Blaise is offline   Reply With Quote
Old 04-11-2024, 06:02 AM   #2
lomkiri
Zealot
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
Quote:
Originally Posted by Peter Blaise View Post
replace:
<div>blah-blah-blah</div>
[...]
or even replace it with:
<blockquote>blah-blah-blah</blockquote>
[...]
So, case closed... unless anyone else has any additional ideas?
Use the plugin "Diaps Editing Toolbag" which is made exactly for that.

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.
lomkiri is offline   Reply With Quote
Old 04-11-2024, 06:16 AM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,246
Karma: 129333566
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>?
JSWolf is offline   Reply With Quote
Old 04-11-2024, 07:13 AM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,843
Karma: 54837878
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by JSWolf View Post
Are they real <div> or are they <div> that should really be <p>?
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.
theducks is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:17 AM.


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