viv:replace

replaces substrings that match a regex with another string

Synopsis

string
	viv:replace
	(str, pattern, newstr, replace-flags);
string    str;
string    pattern;
string    newstr;
""|"g"|"i"|"gi"    replace-flags;

Description

Replace the substrings in str matching the POSIX regex pattern pattern with newstr. Note that back references are NOT supported.

Arguments

Arguments

str in which the replacement has been performed.

Example

    <xsl:value-of select="viv:replace(
    document/@url,
    '(domain1|domain2)\.com',
    'domain3.com', 'gi')" />