[whatwg] Never bring a regular expression knife to a turing complete gunfight. (Was: Allowing ">" in attribute values)

Nils Dagsson Moskopp nils-dagsson-moskopp at dieweltistgarnichtso.net
Thu Jun 24 09:15:01 PDT 2010

"Benjamin M. Schwartz" <bmschwar at fas.harvard.edu> schrieb am Thu, 24
Jun 2010 11:20:10 -0400:

> Worldwide, regarding HTML, I'm sure there is 100 times more regular
> expression processing code than full-on lexing code.  Most code that
> processes HTML is embedded in scripts, doing some small
> special-purpose operation.

Regular expressions can parse strings written in a regular language.
That means no nested elements. And if you want to do a finite number of
nested elements, you have to write one regex for each level. This
requirement alone should kill most general purposes.

Specially crafted scripts, on the other hand, are easily adapted.

> Those regular expressions aren't going
> away.  Helping them break less is a noble cause.

I would argue exactly the opposite: Making stupid invalid parsers break
more would encourage people to use the right facilities. And we are not
even talking about achieving that: ">" in attributes was here for years,
and it is here to stay.

May Zalgo have mercy on your regexes !

Nils Dagsson Moskopp // erlehmann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100624/a26f2205/attachment-0002.pgp>

More information about the whatwg mailing list