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

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


(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 -- -------------------
All I want is a little love and a lot of money. In that order.
------------------------- --

Received on Tuesday, 10 March 1998 10:50:27 UTC