Loading TOC...

MarkLogic Server 11.0 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

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.