W3C home > Mailing lists > Public > www-style@w3.org > March 1998

Re: OPINIONS WANTED: regexps in CSS? (Re: Suggestion for Attribute Selectors)

From: Eric A. Meyer <emeyer@sr71.lit.cwru.edu>
Date: Tue, 10 Mar 1998 10:28:33 -0500
Message-Id: <v03102802b12b08604212@[]>
To: www-style@w3.org
> 1. will this regexp-selector:
>        COL[WIDTH="^ *[0-9]+(\.[0-9]+)? *(\*|px|%)? *$"]
>    match this HTML?
>        <COL width=".9px">

   Got me.

> 2. please send me your attempt at writing a regexp that matches "fr",
>    "fr-ca", "fr-fr", "fr-ca-quebec" (in both upper- and lowercase),
>    etc, but not "franc" or "free" or "fr!" or "de-fr".

   Sorry, I can't.

> 3. how easy is it for you to write such a regexp?

   Impossible.  I understand regexps at a broad conceptual level, but don't
know enough to write any but the simplest of them.

> 4. if you can't write it, would it be hard to learn, do you think?

   Having tried to learn regexps once, and knowing several Perl experts who
still get them wrong on occasion, I think the answer is probably yes.  I
might be able to do it, but it would hurt.  I have trouble thinking in

> 5. can you estimate how easy/hard it is for other people?

   For many people-- and by "many," I refer to the vast majority of Web
page authors-- regexps are far more complicated than anything they wish to
learn.  Remember, the main advantage of HTML is that it's simple enough to
teach to almost anyone, and most of the tags are their own mnemonics.
Style sheets are slightly more complicated, but the properties are
generally named after the effects they (should) create, so they're easy to
understand and remember.
   Regexps are just about the exact opposite.  If you aren't a computer, a
computer scientist, or someone who thinks like one, forget it.  Even
someone like me, who thinks somewhat like a computer scientist, has had
more than a little trouble figuring out regexps.
   Thus, I must disagree that the learning curve is shallow, or even that
regexps are easy or simple.  For most of the world, none of these
assertions are true.  Having taught many, many HTML seminars and gotten a
lot of feedback from my on-line tutorials, there are many people for whom
HTML is as complex a language as they can comprehend.  They aren't stupid--
they just have other things on their minds, like jobs and families and
sports statistics, or their brains aren't oriented toward the kind of
precise, concentrated, analytical thinking which regexps require.  (This is
where I have trouble; my intuitive side keeps getting in the way and I lose
   However, if regexps are available to style sheet authors, but are in no
way required for the construction of a style sheet, then I see no harm in
including them.  Of course, I'm not a browser author, so it's really easy
for me to say that.

                                   -- EMeyer

 One of the opening credits says "based  | Eric A. Meyer  #  eam3@po.cwru.edu
 on an idea by the Spice Girls," but     | http://www.cwru.edu/home/eam3.html
 this should in no way be confused with  |       Hypermedia Systems Manager
"based on an idea by Robert Oppenheimer."|           Digital Media Services
        --CNN movie reviewer Paul Tatara |  Case Western Reserve University
Received on Tuesday, 10 March 1998 10:28:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:46 UTC