# fn:replace

fn:replace(string? $input, string $pattern, string $replacement) → string?

Function signature

$input | xs:string ?
$pattern | xs:string
$replacement | xs:string
Result | xs:string ?

Replaces sequences of characters within a string that match a given regular expression

XPath 2.0 Specification

Note:Upgraded in Saxon 7.9 to match the precise regex syntax and to support all four flags s, m, i, x. Also changed to disallow a pattern that matches a zero-length string.

fn:replace(string? $input, string? $pattern, string? $replacement, string? $flags) → string?

Function signature

$input | xs:string ?
$pattern | xs:string
$replacement | xs:string
$flags | xs:string
Result | xs:string ?

Replaces sequences of characters within a string that match a given regular expression, specifying flags to control the way the regular expression is matched

XPath 2.0 Specification

Note:Upgraded in Saxon 7.9 to match the precise regex syntax and to support all four flags s, m, i, x. Also changed to disallow a pattern that matches a zero-length string.

Expand | Up Next