Re: WWW-Validator Bug (response to private mail on other topic)

On August 2, 1999 at 23:35, Gerald Oskoboiny wrote:

> > If the data is passed in as a single string, a comment
> > stripping regex:
> > 
> > 	s/<!--([^-]|-[^-])*--\s*>//go;
> > 
> > Could first be applied before checking for a doctype declaration.
> 
> Thanks for the regex; I added it in the doctype-checking
> function. Unfortunately this still won't handle multi-line
> comments, so I need to figure out what to do about those.

As pointed out later in discussion, the regex above is not
completely accurate.  Use:

    s/<!(?:--(?:[^-]|-[^-])*--\s*)+>//go;

The first one I gave does not handle multiple "-- --" occurances.

As for multi-line use, you could do a join on the passed in
array to get a single string, and then have a go at it.

Even better, when you get the document data, keep it in
a scalar instead of an array.  Only do a split on the scalar
to get the individual lines for error reporting.

	--ewh

Received on Tuesday, 3 August 1999 03:30:28 UTC