1.\" Copyright (c) 1980, 1991 Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)re_comp.3 6.5 (Berkeley) 08/05/92 7.\" 8.Dd 9.Dt RE_COMP 3 10.Os 11.Sh NAME 12.Nm re_comp , 13.Nm re_exec 14.Nd regular expression handler 15.Sh SYNOPSIS 16.Fd #include <unistd.h> 17.Ft char * 18.Fn re_comp "const char *s" 19.Ft int 20.Fn re_exec "const char *s" 21.Sh DESCRIPTION 22This interface is made obsolete by 23.Xr regex 3 . 24.Pp 25The 26.Fn re_comp 27function 28compiles a string into an internal form suitable for pattern matching. 29The 30.Fn re_exec 31function 32checks the argument string against the last string passed to 33.Fn re_comp . 34.Pp 35The 36.Fn re_comp 37function 38returns 0 if the string 39.Fa s 40was compiled successfully; otherwise a string containing an 41error message is returned. If 42.Fn re_comp 43is passed 0 or a null string, it returns without changing the currently 44compiled regular expression. 45.Pp 46The 47.Fn re_exec 48function 49returns 1 if the string 50.Fa s 51matches the last compiled regular expression, 0 if the string 52.Fa s 53failed to match the last compiled regular expression, and \-1 if the compiled 54regular expression was invalid (indicating an internal error). 55.Pp 56The strings passed to both 57.Fn re_comp 58and 59.Fn re_exec 60may have trailing or embedded newline characters; 61they are terminated by 62.Dv NUL Ns s. 63The regular expressions recognized are described in the manual entry for 64.Xr ed 1 , 65given the above difference. 66.Sh DIAGNOSTICS 67The 68.Fn re_exec 69function 70returns \-1 for an internal error. 71.Pp 72The 73.Fn re_comp 74function 75returns one of the following strings if an error occurs: 76.Bd -unfilled -offset indent 77No previous regular expression, 78Regular expression too long, 79unmatched \e(, 80missing ], 81too many \e(\e) pairs, 82unmatched \e). 83.Ed 84.Sh SEE ALSO 85.Xr ed 1 , 86.Xr ex 1 , 87.Xr egrep 1 , 88.Xr fgrep 1 , 89.Xr grep 1 , 90.Xr regex 3 91.Sh HISTORY 92The 93.Fn re_comp 94and 95.Fn re_exec 96functions appeared in 97.Bx 4.0 . 98