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

On Tue, Aug 03, 1999 at 12:30:18AM -0700, Earl Hood wrote:
> On August 2, 1999 at 23:35, Gerald Oskoboiny wrote:
> > 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.

Thanks... fixed.

> 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.

Both these solutions are doable but sound expensive for large
files. I guess I could join the first 20 lines, strip the
comments, check the result for doctypes, and if I don't find
anything, join the whole file and try again.

-- 
Gerald Oskoboiny       <gerald@w3.org>  +1 617 253 2920
System Administrator   http://www.w3.org/People/Gerald/
World Wide Web Consortium (W3C)      http://www.w3.org/

Received on Tuesday, 31 August 1999 18:51:08 UTC