I've got many HTML files in a folder, for each file I want to replace n-dash and m-dash with linefeed or paragrah mark, but only for specific html class.
For example, I would like to find/replace only text in class "Center". Original:
class=Center <p class="Center">« Sentence1 — Sentence2 – Sentence3</p>
class=Aligned <p class="Aligned">«Other Sentence4 — Other Sentence5 – OtherSentence6«</p>
Desired result:
<p class="Center">« Sentence1 </p><p></p><p> Sentence2 </p><p></p><p> Sentence3«</p>
<p class="Aligned">«Other Sentence4 — Other Sentence5 – OtherSentence6«</p>
So far I'm using this solution by Helen: https://stackoverflow.com/a/1758239/5471234
But implementing this "strText = Replace(strText, "–", "< /p>< p>< /p>< p>")"
performs F/R in the whole text.
How can I limit it to class=Center
? Any way to use RegEx? and/or html object .innerText to grab only specific class?