Description
The functx:substring-after-last-match function returns the part of $arg that appears after the last match of $regex. If $arg does not match $regex, the entire $arg is returned. If $arg is the empty sequence, a zero-length string is returned.
Arguments and Return Type| Name | Type | Description |
$arg |
xs:string? |
the string to substring |
$regex |
xs:string |
the regular expression |
| return value |
xs:string |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:substring-after-last-match
( $arg as xs:string? ,
$regex as xs:string ) as xs:string {
replace($arg,concat('^.*',$regex),'')
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function substring-after-last-match
( $arg as xs:string? ,
$regex as xs:string ) as xs:string {
fn:replace($arg,fn:concat('^.*',$regex),'')
} |
Examples| XQuery Example | Results |
|---|
functx:substring-after-last-match(
'abc-def-ghi', '[ad]')
|
ef-ghi
|
functx:substring-after-last-match(
'abcd-abcd', 'bc?')
|
d
|
functx:substring-after-last-match(
'abcd-abcd', 'x')
|
abcd-abcd
|
See AlsoHistory |
|