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

On Tue, 10 Mar 1998, Eric A. Meyer wrote:

> > 1. will this regexp-selector:
> >
> >        COL[WIDTH="^ *[0-9]+(\.[0-9]+)? *(\*|px|%)? *$"]
> >
> >    match this HTML?
> >
> >        <COL width=".9px">
> 
>    Got me.

me too.

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

Uh, not in this lifetime seems appropriate.

> > 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.
> 
Can I get an amen from the choir? AMEN!

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

Yes! (in your best Ed McMahon voice)
> 
> > 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
> concentration.)
>    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.

Of course, what I'm saying is that I agree absolutely! Requiring REs would
make CSS as unusable as the Hubble Telescope before the retrofix; i.e.., a
great a idea, a wonderful piece of equipment, *but* - it can only be
appreciated (in a limited way) by twirly heads or the nth level. Whereas a
usable Hubble brings pictures to earth even the layman can appreciate for
their clarity and beauty.

Do it right the first time. Send up a piece of equipment that everyone can
use and appreciate... not just the code heads.

> 
>                                    -- 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 12:35:46 UTC