REGEX(2,L) AIX Technical Reference REGEX(2,L) ------------------------------------------------------------------------------- regex: re_comp, re_exec PURPOSE Handles regular expressions. LIBRARY Berkeley Compatibility Library (libbsd.a) SYNTAX char *re_comp (s) char *s; int *re_exec (s) char *s; DESCRIPTION The re_comp subroutine complies a string into an internal form suitable for pattern matching. The re_exec subroutine checks the argument string against the last string passed to re_comp. The re_comp subroutine returns 0 if the string s was compiled successfully; otherwise a string containing an error message is returned. If re_comp is passed to 0 or a null string, it returns without changing the currently compiled regular expression. The re_exec subroutine 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 re_comp and re_exec may have trailing or embedded newline characters; they are terminated by nulls. The regular expressions recognized are described in the manual entry for the ed command, given the above difference. RETURN VALUE If an error occurs, re_exec returns a -1, while re_comp returns one of the following strings: No previous regular expression. Regular expression too long. Unmatched \(. Missing ] Too many \(\) pairs. Processed November 7, 1990 REGEX(2,L) 1
REGEX(2,L) AIX Technical Reference REGEX(2,L) Unmatched \). RELATED INFORMATION In this book: "NCcollate, NCcoluniq, NCeqvmap, _NCxcol, _NLxcol," "regcmp, regex," and "regexp: compile, step, advance." The ed, grep, and sed commands in AIX Operating System Commands Reference. "Introduction to International Character Support" in Managing the AIX Operating System. Processed November 7, 1990 REGEX(2,L) 2