View Single Post
Old 10-18-2021, 08:30 AM   #39
firsikov
Junior Member
firsikov began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Oct 2021
Device: Kindle Voyager
Quote:
Originally Posted by davidfor View Post
Just to check, you want to change the class of the paragraph within the blockquote from "text" to something else? If so, it does work, but, you need to have the "Dot all" option selected. And the replace string is:

Code:
<blockquote class="email">\1<p class="newclassname">\2</blockquote>
But, I would do this with:

Code:
(<blockquote class="email">.*?<p class=")text(">.*?</blockquote>)
And the substitution is:

Code:
\1newclassname\2
Which is basically to use all the put the constant bits into groups and the bit you want to change not selected. This also needs the "Dot all" option to be selected.

For both, you have to run them multiple times. If you do "Replace all", it only makes one change in each blockquote.
Thanks a lot. It works. But! If you have code like that:
Code:
<p class="text">some text</p>
<blockquote class="email">
   <p class="text">some <i>text</i></p>
   <p class="text"><b>some</b> text</p>
   <p class="text">some text</p>
</blockquote>
<p class="text">some text</p>
<p class="text">some text</p>
<blockquote class="email">
   <p class="text">some <i>text</i></p>
   <p class="text"><b>some</b> text</p>
   <p class="text">some text</p>
</blockquote>
<p class="text">some text</p>
First opened <blockquote> and last closed </blockquote> will work too. And when i finish replace all, result will be like that:
Code:
<p class="text">some text</p>
<blockquote class="email">
   <p class="newclass>some <i>text</i></p>
   <p class="newclass><b>some</b> text</p>
   <p class="newclass>some text</p>
</blockquote>
<p class="newclass>some text</p>
<p class="newclass>some text</p>
<blockquote class="email">
   <p class="newclass>some <i>text</i></p>
   <p class="newclass><b>some</b> text</p>
   <p class="newclass>some text</p>
</blockquote>
<p class="text">some text</p>
firsikov is offline   Reply With Quote