Saturday, 15 June 2013

unix - Regex - Delete chars between -



unix - Regex - Delete chars between <!-- and --> -

earlier tried regex trim strings between <!-- , --> (included these tags well), no success.

could give me informations problem?

to match comment in text looks rule xml comments (and close html comments rule) want this:

<!--.*?-->

assuming language's re engine supports non-greedy quantifiers. removal requires repeatedly matching across whole input text , substituting empty string; syntax depends on language in question.

without non-greedy quantifiers, things more complex (nb, off html comments don't want larn details of difference):

<!--([^-]|-[^-])*-->

be aware -- not should encounter in xml comment unless followed >; part of nature of xml comments…

regex unix regex-negation

No comments:

Post a Comment