W3C home > Mailing lists > Public > www-style@w3.org > August 2001

Regular Expressions as CSS Selectors?

From: Claus Färber <list-w3c-style@faerber.muc.de>
Date: 13 Aug 2001 12:58:00 +0200
To: www-style@w3.org
Message-ID: <86oRfgd3cDB@3247.org>

what about adding regular expressions to the CSS selector syntax?

This way, one could reference parts of element content that are
not marked as subelements.

For example:

h1 /W3C/        {color:blue}
/W3C/           {content:url('w3clogo.svg');height:1em}

Of course, the regexp syntax is much more powerfull than just
matching fixed text strings:

/\<-[0-9]{1,2}([0-9]{3})*(\.[0-9]+\)?\>/  {color:red}

Of course, regexps should also be allowed in attribute selectors:


Regexps could also use to replace the *=, ^= and $= syntax from
the CSS3 draft:

element[attribute="bla"]        =>      element[attribute=/^bla$/] /* !!! */

element[attribute*="bla"]       =>      element[attribute=/bla/]
element[attribute^="bla"]       =>      element[attribute=/^bla/]
element[attribute$="bla"]       =>      element[attribute=/bla$/]

It could, in conjunction with the content property, be even used
to rewrite the document's text (in some limited way):

/W3C/   {content: "World Wide Web Consortium"}
/(A)(B)(C)/ {content: $3 $1 $2}

begin  Your-so-called-newsreader-is-seriously-broken
unless you can read this.
Received on Monday, 13 August 2001 07:02:32 UTC

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