<rex $exprs $data[ /]> <split $exprs $data[ /]>
<rex [options] $exprs $data> <split [options] $exprs $data>
rex function searches for each REX expression value of
$exprs in each value of
acts the same way, except that it returns the non-matching data
$data (i.e. the
SPLIT option below). The return
varbyte if the
$data is type
byte, otherwise it is
In version 8 syntax - i.e. when the
(here) is 8 or more, the default in
version 8 -
split are non-looping if
self-closed, looping otherwise (requiring a close tag), like other
loopable statements. In version 7 and earlier syntax, they are
looping if any options (except
SYNTAX) are given, non-looping
split return a list of the
matching (or non-matching) hits from $data, in
addition, the variable
$ret.off contains the integer byte
offsets into the current search buffer where the hits start.
When looping however, hits (and offsets) are returned one at a time
per iteration, and
$next are also set as in
$loop starts at 0). Any statements inside the
block are executed once per returned hit. The loop can be exited with
RETURN.In version 8.00.1645136290 20220217 and
later, the self-closing syntax also sets $loop and $next.
The looping syntax was added in version 2.6.938200000 19990924;
$ret.off in version 3.01.966500000 20000816 (and supported for
non-looping syntax as well in version 6.00.1355622000 20121215).
Note that in version 8 or later syntax - i.e. when the
syntaxversion pragma (here) is
8 or more - return values never accumulate in
$ret.off. Thus the
ROW flag is unneeded, and not
accepted. It is only valid in version 7 and earlier syntax.
ROW indicates that values do not
$ret, and it should not be a loop variable;
each new value erases the previous.
ROW should be used in
split when a large number of return
values are expected but only need to be examined one at a time;
this saves memory and time since all the hits do not have to be
stored in memory.
ROW should also be used when functions
are called within the block, because otherwise
$ret is a
loop variable, hindering multi-value returns.
SKIP=$nSkip the first
$nhits when returning values. This does not affect the value of
MAX=$nReturn at most
SPLITInstead of returning the hit data, return non-matching data, i.e. the parts of
$dataoutside the hits. The REX expressions in effect become delimiters for the data returned. This is similar to the command-line
-v(except there are no delimiters as with command-line
rex). This is the default for the
NONEMPTYIgnore empty (zero-length) return values. This is useful with
SPLITwhen empty values are not significant.
$exprs syntax is RE2 or REX; the default is REX. Note
that the expression syntax may also be changed by prefixing the
expression with "\<re2\>" or "\<rex\>".
Added in version 7.06. See here for more details on RE2.
This option, unlike others, does not imply looping in
rex returns a list of the matching hits from
split returns a list of the non-matching data. The
corresponding byte offsets into the current search item are returned
$ret.off as well.
syntaxversion pragma (here)
affects the syntax of this statement: the
ROW flag is not
accepted in version 8 or later.