Regular Expressions as CSS Selectors?

Hallo,

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:

h1[class=/^head.*/]

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}

Claus
-- 
begin  Your-so-called-newsreader-is-seriously-broken
unless you can read this.
end
                                                    http://www.faerber.muc.de

Received on Monday, 13 August 2001 07:02:32 UTC