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

RE: Comment on xquery/xpath operators draft

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Thu, 17 Jul 2003 19:02:12 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD005@daemsg02.software-ag.de>
To: Jim Whitehead <ejw@cse.ucsc.edu>, ashokma@microsoft.com, jim.melton@acm.org, Norman.Walsh@Sun.COM
Cc: public-qt-comments@w3.org
> Problem #1:
> 
> 
> Ideally what I'd like is the absence of the second operator 
> (the dash in my
> case)  cause the entire string to be returned. This operator 
> could be called "substring-before-or-full" or somesuch.

I would think this can be achieved with regular expressions. Something like:

replace(., "(.*?)(-.*)?", "$1")

(untested)

> 
> Problem #2:
> 
> In the same application, I wanted to be able to strip off 
> just the final path segment of an arbitrary length URI.... What would work
is a "substring-after-last(op1, op2)" that returns the substring of op1
after the last op2 in the string.

Again, I think this is one for regular expressions. Something like: 

replace(., "(.*/)([^/]*)", "$2")

(again untested)


Michael Kay
Received on Thursday, 17 July 2003 13:03:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:13 UTC