Earlier I tried some regex to trim strings between <!-- and -->
(included these tags as well), but no success.
Could you give me some informations about the problem?
Earlier I tried some regex to trim strings between <!-- and -->
(included these tags as well), but no success.
Could you give me some informations about the problem?
To match a comment in text that looks like the rule for XML comments (and very close to the HTML comments rule) you want something like this:
<!--.*?-->
Assuming that your language's RE engine supports non-greedy quantifiers. Removal requires repeatedly matching that across the whole input text and substituting for the empty string; the syntax for that depends on the language in question.
Without non-greedy quantifiers, things get more complex (NB, this is slightly off for HTML comments but you really don't want to learn the details of the difference):
<!--([^-]|-[^-])*-->
Be aware that --
is not something you should encounter in an XML comment unless it is followed by a >
; this is part of the nature of XML comments…