Skip to content

regexp

builtin · libnexusinterp/corefcn/regexp-proprietary.cc

: [tok_start, tok_end, te, match, tokens, names, split] = regexp (str, pat)
: […] = regexp (str, pat, "opt1", …)

Match the regular expression pat against str.

The outputs are, in default order: start indices, end indices, token extents, matched text, tokens, named tokens and the text between matches. Naming any of "start", "end", "tokenExtents", "match", "tokens", "names" or "split" as an option moves that output to the front, in the order given.

Matching options: "once", "ignorecase", "matchcase", "lineanchors", "stringanchors", "dotall", "dotexceptnewline", "freespacing", "literalspacing", "emptymatch" and "noemptymatch".

str and pat may be cell arrays of strings; the outputs are then cell arrays of the per-element results.