DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

re_comp(S)


re_comp, re_exec -- regular expression handler

Synopsis

   char *re_comp(char *s);
   

re_exec(char *s);

Description

The re_comp function converts a regular expression string (RE) into an internal form suitable for pattern matching.

The re_exec function compares the string pointed to by the string argument with the last regular expression passed to re_comp.

If re_comp is called with a null pointer argument, the current regular expression remains unchanged. Strings passed to both re_comp and re_exec must b terminated by a NULL byte, and may include newline characters.

The strings passed to both re_comp and re_exec may have trailing or embedded NEWLINE characters; they are terminated by null characters. The regular expressions recognized are described in the manual page entry for ed(C), given the above difference.

Return values

The re_comp function returns a NULL pointer when the string pointed to by the string argument is successfully converted. Otherwise, a pointer to one of the following strings is returned:
   No previous regular expression
   Regular expression too long
   unmatched \(
   missing ]
   too many \(\) pairs
   unmatched \)

Upon successful completion, re_exec returns 1 if string matches the last compiled regular expression. Otherwise, re_exec returns 0 if string fails to match the last compiled regular expression, and -1 if the compiled regular expression is invalid (indicating an internal error). characters; they are terminated by null characters. The regular expressions recognized are described in the manual page entry for ed(C), given the above difference.

Compatibility

These functions were added to X/Open System Interfaces and Headers, Issue 4, Version 2, but are labelled to be withdrawn in a future issue. For portability, the routines documented on regcomp(S) are preferred.

References

ed(C), ex(C), grep(C), regcmp(C), regcmp(S), regcomp(S), regexp(M), regexpr(S)

Standards conformance

These routines conform to X/Open System Interfaces and Headers, Issue 4, Version 2.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005