![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
![]()
I have not mastered how to do multi-line regex yet with the current engine.
I want to strip all but one layer of all blockquote nestings e.g, go from 2 or more level deep like this <blockquote class="a"> <blockquote class="a"> <blockquote class="a"> <p class="text">some text here</p> </blockquote> </blockquote> </blockquote> and reduce it to <blockquote class="a"> <p class="text">some text here</p> </blockquote> i figure that the regex only needs to shrink 2 layers to 1, then if it is run multiple times it will progressively strip layers until only single layers remain. assume also that I can by inspection insert the appropriate class names into the regex I tried find <blockquote class="calibre11">\s*<blockquote class="calibre11">(.*)</blockquote>\s*</blockquote> with a suitable replace all, but it did not fully automate.( it seemed to only do one instance, evenwhen I said replace all) ; also I was not sure if I needed to tick any options e.g. Dotall |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,003
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:
(?sm)(?<blockquote class="a">\s+){2,}(.+?)(?</blockquote>\s+){2,} replace is \2 <==== I only remove Nested BQ's the {2,} |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
OK - so the {2,} says to only match 2 or more occurrences.
what does the initial (?sm) do , please. if I plan on keeping one level of block quote, that needs to be in the replace also , I assume, just replace \2 will remove all the blockquotes & leave only the text |
![]() |
![]() |
![]() |
#4 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,003
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:
m on multilines s treat as a single line the \2 is the second capture (.+?), so surround it with a BQ set in the replace |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Centering blockquotes | ghostyjack | ePub | 6 | 07-17-2014 06:07 AM |
need help with nested template | Jade Aislin | Library Management | 2 | 11-30-2012 02:04 AM |
Content nested collections | alexxx | Amazon Kindle | 6 | 06-22-2010 06:05 PM |
ebook publisher & blockquotes | Chauncey | IMP | 5 | 02-10-2010 10:43 AM |
Are Nested TOCs Possible? | VikingDave | Sony Reader | 11 | 12-28-2007 07:58 PM |