2.11BSD/man/cat3/re_comp.0
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), egrep(1), fgrep(1), grep(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:
_N_o _p_r_e_v_i_o_u_s _r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n,
_R_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n _t_o_o _l_o_n_g,
_u_n_m_a_t_c_h_e_d _\(,
_m_i_s_s_i_n_g ],
_t_o_o _m_a_n_y _\(_\) _p_a_i_r_s,
_u_n_m_a_t_c_h_e_d _\).
Printed 11/26/99 May 15, 1985 1