Matching unopened tag
I have some html where there are some unopened
</i> tags on a per line basis and I want to delete them. I.e. in this line there are two of these.
αντιστρόφως, </i>συνήθως βρίσκεται <i>ο</i> αντί <i>ο</i>, βλ. <i>ο</i>, έπειτα, παροδηγώ, παραπλανώ</i>, λέγεται για
I got as far as matching well formed ones:
<i>(.*?)</i>
But then the only thing I could come with was do a find a replace on the remaining text (which would ignore the matched ones) to delete the remaining instances of closing tag (which is unopened), if somehow the matched text was excluded.
I tried an html tidy extension on Notepad++ but it would break lines and add irrelevant code.
Any ideas?I also tried using Tidy as external tool https://emeditor.wpengine.com/text-editor-features/extensibility/external-tools/ but it seems to have the same issue, I.e. adding extra line breaks.
Hello Spiros,
hopefuly i've understood the question - does this give you what you require?:
With "Use Regualr Expressions ticked" and under "Advanced" - "^ and $ can Match beginning and End of the selection"
Find:^([^<i>]*)</i>
Replace with:\1
"Replace All" until no more instances found).
then
Find:(</i>[^</i>]*)</i>
Replace with:\1
(again, "Replace All" until no more instances found).
Yes, works great, thank you!
4 posts in this topic