Re: OPINIONS WANTED: regexps in CSS?

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 UTC