I am looking for a Regex to match comments in XML documents:
<root>
<!--
match this
-->
<but>not this</but>
<!--
and also this
-->
</root>
I've tried <!--[^(-->)]*-->, which only matches single line comments, and <!--[\s\S\n]*--> which matches non-commented nodes as well.
<div> <-- comment -->. The\nis useless in the character class,[\s\S]stands for any character, including newline. – Toto May 18 '20 at 10:36^and$. Regarding[\s\S\n], see the above comment by the OP saying that adding the\nwas necessary for their regex tool. – timotree May 18 '20 at 17:16