in reply to Re: Tokenizing XML
in thread Tokenizing XML

Hmmm I was playing with the comment sub expression and I think this might work (dunno, i played with look aheads but those arn't realy my speciality. ;))

my $test = qr/(<!--(?:[-][^-]|[^-])*-->)/; for ( "<!-- -->", "<!----->", "<!--- -->", "<!---->" , "<!-- - -- -->" +) { print $_, ($_ =~ $test ? "ok": "fail"),"\n"; }

So it should match anything that looks like a comment and the only tuime it has two dashes in a row is at the begging and at the end. Needs mroe vigerous testing though.


___________
Eric Hodges