![]() |
#1 |
my parent's oops...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 491
Karma: 1477572
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW
|
Regex search and replace in bulk metadata help
I am trying to remove all html formatting from the comments in my library metadata so that when I make catalogs, the html span, div, font, stuff doesn't make the resulting catalog epub look messy.
I tried the "remove" formatting button individually, but that doesn't remove the html code from the comments section. Then, after searching the forum, I found a pretty good, but not perfect solution, where using the S&R under the bulk metadata edit function, I used the search regex: Code:
<[^<>]*> My regex skills are not the best nor the worst, but I was wondering if anyone has any ideas that could help me remove the <br> tags in bulk? |
![]() |
![]() |
![]() |
#2 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I think your regex is fine...
calibre reformats the comments, putting them into a final div IIRC, and if you have multi-paragraph comments those need to be divided up somehow. ![]() In HTML mode line-breaks are collapsed into whitespace and paragraphs respect the <p> tags, but after nuking the tags if you have line-breaks calibre will do it's best to recreate a basic structure, and probably inserted hard line-breaks where it thought ( ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
my parent's oops...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 491
Karma: 1477572
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW
|
eschwartz, your reply makes total sense. However, the "line breaks" not having a <br> tag in the html comments are not <br>'d by calibre during the S&R process. This only occurs with the comments that already contain <br> tags interspersed within the sentences from the downloaded metadata. This means that calibre must be ignoring the <br> tags when searched from the edit metadata dialog.
I'm super happy that the S&R removes all the other html junk and will live with manually editing out the <br> as necessary, I just thought that I was doing something wrong or there was an easy answer I was missing. |
![]() |
![]() |
![]() |
#4 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,938
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
choices are replace with: a space (long line) replace with the parent tag pair reversed: </p> <p>, </h3> <h3> ... (multiple similar styled lines) |
|
![]() |
![]() |
![]() |
#5 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,938
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You might avoid this in the future by making a metadat download setting change
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
First:: I *thought* calibre would turn hard line breaks into <br>'s, but now I am not so sure...
Anyway. So I entered this into the comments column in an empty book (test library ![]() Code:
<p>I think your regex is fine... <br><br> calibre reformats the comments, putting them into a final div IIRC, and if you have multi-paragraph comments those need to be divided up somehow. <br><br> :bulb2: Paragraph == anytime there is a line-break. <br><br> In HTML mode line-breaks are collapsed into whitespace and paragraphs respect the <p> tags, but after nuking the tags if you have line-breaks calibre will do it's best to recreate a basic structure, and probably inserted hard line-breaks where it thought (:rolleyes:) you wanted them.</p> Search: Code:
<br> Result: Code:
<p>I think your regex is fine... calibre reformats the comments, putting them into a final div IIRC, and if you have multi-paragraph comments those need to be divided up somehow. :bulb2: Paragraph == anytime there is a line-break. In HTML mode line-breaks are collapsed into whitespace and paragraphs respect the <p> tags, but after nuking the tags if you have line-breaks calibre will do it's best to recreate a basic structure, and probably inserted hard line-breaks where it thought (:rolleyes:) you wanted them.</p> ![]() |
![]() |
![]() |
![]() |
#7 |
my parent's oops...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 491
Karma: 1477572
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW
|
|
![]() |
![]() |
![]() |
#8 |
my parent's oops...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 491
Karma: 1477572
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Edit metadata in bulk vs search and replace | inl1ner | Library Management | 6 | 07-14-2014 06:58 PM |
regex search/replace - how to? | Alt68er | Sigil | 1 | 03-11-2014 08:53 PM |
regex search/replace | Sharlene | Sigil | 10 | 01-28-2012 04:14 AM |
need regex help search and replace | schuster | Calibre | 4 | 01-10-2011 09:00 AM |
Setting series index in bulk metadata search&replace | bubak | Calibre | 4 | 12-19-2010 04:04 PM |