MarkLogic 12 EA 1 Product Documentation
fn.tokenize

fn.tokenize(
   input as String?,
   pattern as String,
   [flags as String]
) as Sequence

Summary

Returns a sequence of strings constructed by breaking the specified input into substrings separated by the specified $pattern. The specified $pattern is not returned as part of the returned items.

Parameters
input The string to tokenize.
pattern The regular expression pattern from which to separate the tokens.
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.tokenize("this is a string", " ");

=> returns the Sequence containing:
   ("this", "is", "a", "string")

var arr = fn.tokenize("this is a string", " ").toArray();
arr[arr.length-1]

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