0

I wish to match COMMENT as <!--C--> so:

  1. It starts with <!--
  2. Ends with the first -->
  3. C - could be anything (including tabs, line breaks, etc.)

I got a problem with ending in the first -->

and thus obviously this solution doesn't work: COMMENT (\<!--((.|(\n))*)--\>)

Any suggestions?

Lesmana
  • 25,663
  • 9
  • 82
  • 87
user550413
  • 4,609
  • 4
  • 25
  • 26

1 Answers1

0

Try this:

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

I know that's a bit of a pain to read. It translates to:

An <!-- followed by any number of:

  • anything other than a dash, or

  • a single dash followed by anything other than a dash (including >), or

  • two or more dashes, followed by anything other than a dash or a >

and then finally two or more dashes followed by a >

rici
  • 234,347
  • 28
  • 237
  • 341