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

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

From: Stephanos Piperoglou <sp249@cam.ac.uk>
Date: Tue, 10 Mar 1998 15:48:40 +0000 (GMT)
To: Bert Bos <Bert.Bos@sophia.inria.fr>
cc: www-style@w3.org
Message-ID: <Pine.LNX.3.96.980310150449.15510A-100000@teatime.joh.cam.ac.uk>
I've sent this personally in order to avoid flooding the list with
responses. If this wasn't your intention, please bounce it back to the list.

On Tue, 10 Mar 1998, Bert Bos wrote:

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

Nope, for several reasons. It's rather ugly.

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

/^fr(-\w*)*$/i

(That's Perl regexp, with the /i for case-insensitive, and \w for
alphanumeric characters). There are at least 10 other ways of doing it, some
probably more efficient and shorter. I just came up with this at the top of
my head.

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

Piece of cake. But then again I'm fluent in Perl and that comes as a bonus.

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

About as hard as looking up a good piece of documentation like perlre(1).

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

The lay user designing John Q. Public's Homepage? Impossible. The advanced
computer user could learn it in a minute.

-- Stephanos Piperoglou -- sp249@cam.ac.uk -------------------
All I want is a little love and a lot of money. In that order.
------------------------- http://www.thor.cam.ac.uk/~sp249/ --
Received on Tuesday, 10 March 1998 10:50:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:54 GMT