MarkLogic 12 EA 1 Product Documentation
fn.replace

fn.replace(
   input as String?,
   pattern as String,
   replacement as String,
   [flags as String]
) as String?

Summary

Returns a string constructed by replacing the specified $pattern on the $input string with the specified $replacement string.

Parameters
input The string to start with.
pattern The regular expression pattern to match. If the pattern does not match the $input string, the function will return the $input string unchanged.
replacement The regular expression pattern to replace the $pattern with. It can also be a capture expression (for more details, see http://www.w3.org/TR/xpath-functions/#func-replace).
flags The flag representing how to interpret the regular expression. One of "s", "m", "i", or "x", as defined in http://www.w3.org/TR/xpath-functions/#flags.

Example

fn.replace("this is a string", "this", "that");

=> that is a string
Powered by MarkLogic Server | Terms of Use | Privacy Policy