Command: regexec

NEST HelpDesk Command Index NEST Quick Reference

Name:
 regexec - compare string and regular expression 
Synopsis:
 regex string integer integer -> array integer
          regex string 0       integer -> integer

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.
 
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]]
 
Bugs:
 no knwon ;-)
Diagnostics:
 no errors raised
Author:
 Diesmann & Hehl
FirstVersion:
 27.9.99
Remarks:
 See man regexec for further details on POSIX regexec.
SeeAlso:regexec regcomp
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/lib/sli/regexp.sli

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative