Mercurial > hg > mpdl-group
comparison software/eXist/webapp/mpdl/_stuff/oxygen-projects/monte-project/util/functx.xql @ 7:5589d865af7a
Erstellung XQL/XSL Applikation
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 08 Feb 2011 15:16:46 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:2396a569e446 | 7:5589d865af7a |
---|---|
1 xquery version "1.0"; | |
2 | |
3 module namespace functx = "http://www.functx.com"; | |
4 | |
5 declare function functx:substring-before-last( $arg as xs:string?, $delim as xs:string ) as xs:string { | |
6 if (matches($arg, functx:escape-for-regex($delim))) | |
7 then replace($arg, | |
8 concat('^(.*)', functx:escape-for-regex($delim),'.*'), | |
9 '$1') | |
10 else '' | |
11 }; | |
12 | |
13 declare function functx:substring-after-last( $arg as xs:string?, $delim as xs:string ) as xs:string { | |
14 replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') | |
15 }; | |
16 | |
17 declare function functx:escape-for-regex( $arg as xs:string? ) as xs:string { | |
18 replace($arg, | |
19 '(\.|\[|\]|\\|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1') | |
20 }; |