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@[195.7.72.70]>
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

___Carl_Johan_Berglund_________________________
   Adverb Information
   carl.johan.berglund@adverb.se
   http://www.adverb.se/
Received on Tuesday, 10 March 1998 10:59:24 GMT

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