The replace() function constructs an output string from an input string by replacing all occurrences of substrings that match a supplied regular expression with a given replacement string. The replacement string may include references to captured groups within the input string.
Argument | Data Type | Meaning |
---|---|---|
input | xs:string? | The input string. If an empty sequence is supplied, an empty sequence is returned |
regex | xs:string | The regular expression. This must not be a regular expression that matches a zero-length string |
replacement | xs:string | The replacement string |
flags (optional) | xs:string | One or more letters indicating options on how the matching is to be performed. If this argument is omitted, the effect is the same as supplying a zero-length string, which defaults all the option settings. The flags are the same as for the <xsl:analyze-string> instruction described on page 176 |
Result | xs:string? | The string produced by replacing those substrings of the input string that match the regular expression |