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

Re: OPINIONS WANTED: regexps in CSS?

From: Carl Johan Berglund <carl.johan.berglund@adverb.se>
Date: Tue, 10 Mar 1998 16:57:37 +0100
Message-Id: <l0310280bb12b10641646@[]>
To: Steven Pemberton <Steven.Pemberton@cwi.nl>
Cc: Bert Bos <Bert.Bos@sophia.inria.fr>, www-style@w3.org
At 16.25 +0100 98-03-10, Steven Pemberton wrote:
> > What about:
> >
> > 	^ *(fr|FR)(-[A-Za-z]+)* *$
><P lang="Fr-not">Wrong!.</P>
>This might do it better:
>	^[fF][rR][-A-Za-z]*

I wasn't trying to match "fR" or "Fr". Your regexp would match those two,
but also "free" or "franc-centime" and even "From A to Z" (Since you
omitted the end-of-string "$", the regexp kan match only the beginning of
the string, so that any string starting with FR, fr, Fr or fR will match.
With the trailing "$", it will still match any string starting with FR, fr,
Fr or fR, if the string consists only of letters and hyphens - like "free"
or "franc-centime".).

A regexp that matches language codes of mixed  case would be something like:

^ *[fF][rR](-[A-Za-z]+)* *$

Note that I, as Bert did, permits spaces in the beginning and end of the
string. Hence the " *".

Best regards,
Carl Johan Berglund

   Adverb Information
Received on Tuesday, 10 March 1998 10:59:24 UTC

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