I want to capture html comments with the exception of a specific comment i.e,
<!-- end-readmore-item -->
At the moment, I can successfully capture all of the HTML comments using the regex below,
(?=<!--)([\s\S]*?)-->
To ignore the specified comment, I have tried the lookahead and lookbehind assertions but being new at the advanced level of Regex I am probably missing out on something.
So far, I have been able to devise the following regex using lookarounds,
^((?!<!-- end-readmore-item -->).)*$
I expect it to ignore the end-readmore-item comment and only capture other comments such as,
<!-- Testing-->
However, it does the job but also captures the regular HTML tags which I want to be ignored as well.
I have been using the following html code as a test case,
<div class="collapsible-item-body" data-defaulttext="Further text">Further
text</div>
<!-- end-readmore-item --></div>
</div>
<!-- -->
it only should match with <!-- --> but it's selecting everything except <!--
end-readmore-item -->
the usage of this is gonna be to remove all the HTML comments except <!--
end-readmore-item -->