Re: OPINIONS WANTED: regexps in CSS?

[there's a very quick recap at the bottom if you're in a rush!]

Well I certainly set the cat among the pigeons with this regular expression
suggestion...


Personally, I can use regexp and do so occasionaly. I'm not fluent, but
there is not that much to learn. It would be no harder than setting up a
style sheet for the first time (for which I just read the spec three times,
cover to cover, then had a go).

As many people have said, regexps are not something which would be used in
everyday styling. However, for anything more complicated, regexp provide the
ideal future-proof solution. It would also ease implementation (probably) if
the four already drafted attribute selectors were simply shorthand for
regexp code:

ELEMENT[attr]
ELEMENT[attr="^.*$"]

ELEMENT[attr=value]
ELEMENT[attr="^value$"]

ELEMENT[attr~=value]
ELEMENT[attr="^[.* | *]value[ +.*| *]$"]

ELEMENT[lang|=fr]
ELEMENT[attr="^ *[fF][fR](-[A-Za-z]+)* *$"]

(note that I have used double quotes to delimit the expressions, so that
they can be recognised as such).


Braden said:
>I think it would be great to have REs available for style
>sheet authoring, but they must not be required for using CSS.
>I'd suggest that anything that can be expressed in
>a RE in CSS should be able to be expressed in other
>means, even if they are much more verbose.

Well, I wouldn't quite say *anything*, since that would mean reinventing the
wheel. However, certainly for the more common tasks - presence, exact match,
one-in-a-list match and maybe even language codes - the shorthand would make
life simpler.


Victoria said:
>The use of these REs seems to go counter to what the
>web is all about, and it *ain't* about having the "advanced"
>users be the only ones to use it to the fullest.

Only the "advanced" users are going to be inventing DTDs for their XML yet
this has been accepted by the W3C. For the more complicated features, the
less advanced users will simply use authoring tools which write the regexp
for them.


RECAP
=====
Of the replies to the list so far, Todd, Braden, Aymeric, Me, Ian, and Carl
have been in favour of including regexp in CSS2, Eric said he saw no harm,
Bert, Tim, Stephanos and Steven have replied but not given their view, and
Victoria has been against it.

--
Ian Hickson
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12   Info: www.geekcode.com
GIT/M/S d->-- s+: a--- C++(+++)>$ U P L+ !E W+++ N+ o? K? w@ O- !M V- PS+
PE- Y+ PGP t 5+++>++++ X- R(+++) tv b++(+++) DI++ D++ G e(*)>+++++ h!()(--)
!r y?
------END GEEK CODE BLOCK------

Received on Tuesday, 10 March 1998 18:33:02 UTC