Mercurial > hg > mpdl-group
view software/eXist/webapp/mpdl/_stuff/oxygen-projects/monte-project/util/functx.xql @ 25:e9fe3186670c default tip
letzter Stand eingecheckt
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 21 May 2013 10:19:32 +0200 |
parents | 5589d865af7a |
children |
line wrap: on
line source
xquery version "1.0"; module namespace functx = "http://www.functx.com"; declare function functx:substring-before-last( $arg as xs:string?, $delim as xs:string ) as xs:string { if (matches($arg, functx:escape-for-regex($delim))) then replace($arg, concat('^(.*)', functx:escape-for-regex($delim),'.*'), '$1') else '' }; declare function functx:substring-after-last( $arg as xs:string?, $delim as xs:string ) as xs:string { replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') }; declare function functx:escape-for-regex( $arg as xs:string? ) as xs:string { replace($arg, '(\.|\[|\]|\\|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1') };