Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

regexp(3)

re_comp(3)  —  Subroutines

OSF

NAME

re_comp, re_exec −  Handles regular expressions

LIBRARY

Standard C Library (libc.a)
Berkeley Compatibility Library (libbsd.a)

SYNOPSIS

char ∗re_comp(
char ∗string) ; int re_exec(
char ∗string) ;

PARAMETERS

stringPoints to the string that is to be matched or converted. 

DESCRIPTION

The re_comp()  function converts a string into an internal form suitable for pattern matching.  The re_exec() function compares the string parameter with the last string passed to the re_comp() function. 

When the re_comp() function is passed a value of 0 (zero) or null, the regular expression currently being converted remains unchanged. 

Strings passed to both the re_comp() and re_exec() functions may have trailing or embedded newline characters; however, these strings are terminated by a null.  Recognized regular expressions are described in the reference page for the regexp functions (advance(), compile() and step()).  Refer to that reference page when the differences described above are noted. 

RETURN VALUES

The re_comp() function returns 0 (zero) when the string pointed to by the string parameter is successfully converted; otherwise an error message string is returned.  The re_exec() function returns 0 (zero) when the string is recognized by the last compiled regular expression and a value of +1 when the string pointed to by the string parameter fails to match the last converted regular expression; the value -1 is returned when the converted regular expression is invalid (indicating an internal error). 

ERRORS

Upon error, the re_exec() function returns a value of -1, and the re_comp() function returns a string indicating the nature of the error. 

RELATED INFORMATION

Function: regexp(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026