92 lines
1.7 KiB
Groff
92 lines
1.7 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g1.regcmp @(#)regcmp 30.3 of 1/14/86
|
|
.nr X
|
|
.if \nX=0 .ds x} REGCMP 1 "Advanced C Utilities" "\&"
|
|
.if \nX=1 .ds x} REGCMP 1 "Advanced C Utilities"
|
|
.if \nX=2 .ds x} REGCMP 1 "" "\&"
|
|
.if \nX=3 .ds x} REGCMP "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
regcmp \- regular expression compile
|
|
.SH SYNOPSIS
|
|
.B regcmp
|
|
[
|
|
.B \-
|
|
] files
|
|
.SH DESCRIPTION
|
|
The
|
|
.IR regcmp
|
|
command performs a function similar to
|
|
.IR regcmp (3X)
|
|
and, in most cases, precludes
|
|
the need
|
|
for calling
|
|
.IR regcmp (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\f1.\fP
|
|
If the \f3\-\fP
|
|
option is used, the output will be placed in
|
|
.IB file .c\f1.\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\^
|
|
in
|
|
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 \f2regcmp\fP output,
|
|
.PP
|
|
.RS
|
|
regex(telno, line, area, exch, rest)
|
|
.RE
|
|
.PP
|
|
will apply the regular expression named \f2telno\fP to \f2line\fP.
|
|
.SH SEE ALSO
|
|
regcmp(3G).
|
|
.\" @(#)regcmp.1 6.2 of 9/2/83
|
|
.Ee
|
|
'\".so /pubs/tools/origin.att
|