regexec

Command: regexec


Description
regexec evaluates the given regular expression and looks whether it
is contained within a given string. It returns failure/success and the
offsets of the position where the regular expression was matched.
The same is true for any paranthesized subexpression: Those offsets are
stored in an array up to the chosen depth.
Flags and other codes REG_... are found in dictionary regexdict.
Parameters
in: string is the string where te regular expression should be
looked for; regex is a regular expression generated by regcomp
first integer is the depth of paranthesized subexpression offsets
that should be returned
second integer is a flag for details see POSIX regexec
(set to zero if in doubt!)
out: integer is 0 if it matched nonzero else (POSIX regexec error code)
array: an array of [beginoffset endoffset] arrays indicating
the matches of the regex an any paranthesized subregexes within
the string.

Author
Diesmann & Hehl
Bugs
no knwon ;-)
Synopsis
regex string integer integer -> array integer
regex string 0 integer -> integer

Examples
(remember regexdict begin for these examples!)
1) (simple) REG_EXTENDED regcomp ->
( simple ) 0 0 regexec -> 0 %this 0 indicating success
2) (simple) REG_EXTENDED regcomp ->
( simple ) 1 0 regexec -> [[3 9]] 0
% this 3 9 are begin and end offsets of matched regex!
3) ((paranthesize)+.*example) regcomp ->
(This is a paranthesize using example) 2 0 regexec -> 0 [[10 36] [10 22]]

File
lib/sli/regexp.sli
Diagnostics
no errors raised
Remarks
See man regexec for further details on POSIX regexec.
FirstVersion