4BSD/usr/man/cat3/regex.3

Compare this file to the similar file:
Show the results in this format:




REGEX(3)            UNIX Programmer's Manual             REGEX(3)



NAME
     re_comp, re_exec - regular expression handler

SYNOPSIS
     char *re_comp(s)
     char *s;

     re_exec(s)
     char *s;

DESCRIPTION
     _R_e__c_o_m_p compiles a string into an internal form suitable for
     pattern matching. _R_e__e_x_e_c checks the argument string against
     the last string passed to _r_e__c_o_m_p.

     _R_e__c_o_m_p returns 0 if the string _s was compiled successfully;
     otherwise a string containing an error message is returned.
     If _r_e__c_o_m_p is passed 0 or a null string, it returns without
     changing the currently compiled regular expression.

     _R_e__e_x_e_c returns 1 if the string _s matches the last compiled
     regular expression, 0 if the string _s failed to match the
     last compiled regular expression, and -1 if the compiled
     regular expression was invalid (indicating an internal
     error).

     The strings passed to both _r_e__c_o_m_p and _r_e__e_x_e_c may have
     trailing or embedded newline characters; they are terminated
     by nulls.  The regular expressions recognized are described
     in the manual entry for _e_d (1), given the above difference.

SEE ALSO
     ed(1), ex(1)

DIAGNOSTICS
     _R_e__e_x_e_c returns -1 for an internal error.

     _R_e__c_o_m_p returns one of the following strings if an error
     occurs: "No previous regular expression", "Regular expres-
     sion too long", "unmatched \(", "missing ]", "too many \(\)
     pairs", "unmatched \)".














Printed 11/10/80             2/29/80                            1