SysIII/usr/src/man/man1/regcmp.1

Compare this file to the similar file:
Show the results in this format:

.TH REGCMP 1
.SH NAME
regcmp \- regular expression compile
.SH SYNOPSIS
.B regcmp
[
.B \-
] files
.SH DESCRIPTION
.IR Regcmp ,
in most cases, precludes
the need
for calling
.I regcmp
(see
.IR regex (3X))
from
C programs.
This saves on both execution time and program size.
The command
.I regcmp\^
compiles the regular expressions in
.I file\^
and places the output in
.IB file .i\fR.\fP
If the \fB\-\fP
option is used, the output will be placed in
.IB file .c\fR.\fP
The format of entries in
.I file\^
is a name (C
variable) followed by one or more blanks followed by
a regular expression enclosed in double quotes.
The output of
.I regcmp\^
is
C source code.
Compiled regular expressions are represented as
.B "extern char"
vectors.
.IB File .i
files may thus be
.I included\^
into
C programs,
or
.IB file .c
files may be compiled and later loaded.
In the
C program which
uses the
.I regcmp\^
output,
.IR regex ( abc , line )
will apply the regular expression named
.I abc\^
to
.IR line .
Diagnostics are self-explanatory.
.SH EXAMPLES
.TP "\w'telno\ \ \ \ 'u"
name
"([A\-Za\-z][A\-Za\-z0\-9\_]\(**)$0"
.TP
telno
"\\({0,1}([2\-9][01][1\-9])$0\\){0,1} \(**"
.br
"([2\-9][0\-9]{2})$1[ \-]{0,1}"
.br
"([0\-9]{4})$2"
.TP
In the C program that uses the \fIregcmp\fP output,
.PP
.RS
regex(telno, line, area, exch, rest)
.RE
.PP
will apply the regular expression named \fItelno\fP to \fIline\fP.
.SH SEE ALSO
regex(3X).