re_comp()

QNX SDP8.0C Library ReferenceAPIDeveloper

Compile a regular expression

Synopsis:

#include <unix.h>

char *re_comp( char *s );

Arguments:

s
A string that contains the regular expression that you want to compile. This string must end with a null byte and may include newline characters. If this argument is NULL, the current regular expression remains unchanged.

Library:

libregex

Use the -l regex option to qcc to link against this library.

Description:

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

The re_comp() and re_exec() functions support simple regular expressions. The regular expressions of the form \{m\}, \{m,\}, or \{m,n\} aren't supported.

Note:
For better portability, use regcomp(), regerror(), and regexec() instead of these functions.

Returns:

NULL if the string pointed to by s was successfully converted. Otherwise, a pointer to one of the following error message strings is returned:

  • No previous regular expression
  • Regular expression too long
  • unmatched \(
  • missing ]
  • too many \(\) pairs
  • unmatched \)

Classification:

Legacy Unix

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: