W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2003

RE: back references in regexen

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Wed, 21 May 2003 18:54:44 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DCE66@daemsg02.software-ag.de>
To: Tobias Reif <tobiasreif@pinkjuice.com>, public-qt-comments@w3.org

I agree this can be a handy feature, but I don't think we want to diverge
from the XML Schema regular expression syntax except for facilities that
require more than boolean matching. The other consideration is that we want
to stick to a core subset of features that are widely available in existing
regular expression libraries, to make life livable for implementors.

Michael Kay

> -----Original Message-----
> From: Tobias Reif [mailto:tobiasreif@pinkjuice.com] 
> Sent: 21 May 2003 14:51
> To: public-qt-comments@w3.org
> Subject: back references in regexen
> 
> 
> 
> about
> http://www.w3.org/TR/xmlschema-2/#regexs
> 
> Hi
> 
> It would be very handy to have a back reference mechanism in 
> the regexen 
> spec use by XSLT etc. Much more succinct code could be 
> written. (unless 
> I miss an existing feature)
> 
> Demo
> 
>   code = "foo = 'bar'"
>   # also works when " is used as attribute value delimiter
> 
>   code =~ /([^\s=]+)(\s*)(=)(\s*)(['"])([^\5]+)(\5)/
> 
>   (1..7).each do |i|
>     print i.to_s+': '
>     p eval('$'+i.to_s)
>   end
> 
> brings
> 
>   ruby backref.rb
>   1: "foo"
>   2: " "
>   3: "="
>   4: " "
>   5: "'"
>   6: "bar"
>   7: "'"
> 
> 
> A concrete Use Case
> 
> Marking up XML code listings.
> 
> XSLT: (slightly outdated) 
> http://www.pinkjuice.com/howto/vimxml/xslt/tinydbk2xhtml/marku
p_xml.xslt2
Sample output:
http://www.pinkjuice.com/howto/vimxml/intro.xml (at the bottom)

Tobi

-- 
http://www.pinkjuice.com/
Received on Wednesday, 21 May 2003 12:55:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:24 GMT