regcmp(1) regcmp(1)
NAME
regcmp - regular expression compile
SYNOPSIS
regcmp [-] file . . .
DESCRIPTION
The regcmp command performs a function similar to regcmp and,
in most cases, precludes the need for calling regcmp from C
programs. Bypassing regcmp saves on both execution time and
program size. The command regcmp compiles the regular
expressions in file and places the output in file.i. If the -
option is used, the output is placed in file.c. The format of
entries in file is a name (C variable) followed by one or more
blanks followed by one or more regular expressions enclosed in
double quotes. The output of regcmp is C source code.
Compiled regular expressions are represented as extern char
vectors. file.i files may thus be #included in C programs, or
file.c files may be compiled and later loaded. In the C
program that uses the regcmp output, regex(abc,line) applies
the regular expression named abc to line. Diagnostics are
self-explanatory. regcmp processes supplementary code set
characters in files according to the locale specified in the
LC_CTYPE environment variable [see LANG on environ(5)].
Pattern searches are performed on characters, not bytes, as
described on ed(1). A backslash in the input quotes the next
character(s). The recognized characters that can follow a
backslash are n, t, r, b, up to three octal digits, and
another backslash. Any other character is sent through
unchanged, but the backslash is removed.
EXAMPLES
name "([A-Za-z][A-Za-z0-9_]*)$0"
telno "\\({0,1}([2-9][01][1-9])$0\\){0,1} *"
"([2-9][0-9]{2})$1[-]{0,1}"
"([0-9]{4})$2"
The three arguments to telno shown above must all be entered
on one line.
In the C program that uses the regcmp output,
regex(telno, line, area, exch, rest)
Copyright 1994 Novell, Inc. Page 1
regcmp(1) regcmp(1)
applies the regular expression named telno to line.
REFERENCES
ed(1), regcmp(3G)
Copyright 1994 Novell, Inc. Page 2