Name: regexec - compare string and regular expression

Synopsis:

regex string integer integer -&gt; array integer 
regex string 0       integer -&gt; integer


Examples:

1) (simple) regcomp -&gt; &lt;regextype&gt; 
(   simple   ) 0 0 regexec -&gt; 0  % this 0 indicating success 
2) (simple) regcomp -&gt; &lt;regextype&gt; 
(   simple   ) 1 0 regexec -&gt; [[3 9]] 0 
% this 3,9 are begin and end offsets of matched regex! 
3) ((parenthesize)+.*example) regcomp -&gt; &lt;regextype&gt; 
(This is a parenthesize using example) 2 0 regexec -&gt; [[10 36] [10 22]] 0 
4) This is a more complex example showing how more and more parenthesized 
expressions are returned 
/rx (:(passed|result|error):([0-9]+):(.*):) regcomp def 
/st (:result:4:this is the result:) def 
rx st 0 0 regexec -&gt; 0 
rx st 1 0 regexec -&gt; [[0 29]] 0 
rx st 2 0 regexec -&gt; [[0 29] [1 7]] 0 
rx st 4 0 regexec -&gt; [[0 29] [1 7] [8 9] [10 28]] 0


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.


Diagnostics:

no errors raised


Remarks:

See man regexec for further details on POSIX regexec.


Author:

Diesmann &amp; Hehl


FirstVersion:

27.9.99


SeeAlso:

regexec
regcomp

Source:

/var/www/debian/nest/nest-simulator-2.20.0/lib/sli/regexp.sli
