COHERENT manpages

This page displays the COHERENT manpage for regsub() [Use regular expression to build a string].

List of available manpages
Index


regsub() -- Regular-Expression Function (libc)

Use regular expression to build a string
 "#include <regexp.h>"
regsub(expression, source, dest)
regexp *expression;
char *source, *dest;

Function regsub() builds a string from a string and a regular expression.

source is  the source string that is being  interpreted.  expression is the
regular expression through which  source is being interpreted; it must have
been built by a call to regcomp(). Before you call regsub(), you must first
have  called  regexec()  to  compare  them  and initialize  the  sub-string
pointers within expression.

dest  points  to the  memory  into which  regsub()  writes its  substituted
string.   It  replaces each  instance  of `&'  within  source with  the
substring  indicated  by  startp[0]  and  endp[0].  It also  replaces  each
instance of `\n', where n is a digit, with the substring startp[n]      and
endp[n].

For details  on how these  pointers are initialized, see  the Lexicon entry
for regsub().  For more  details on the  structure regexp, see  the Lexicon
entry  for regexp.h.  The  rules that  describe a  regular expression  also
appear in function regexp.h.

See Also

libc,
regexp.h