88 lines
1.6 KiB
Plaintext
88 lines
1.6 KiB
Plaintext
.\" @(#)regcmp.1v 1.1 92/07/30 SMI; from S5R2 6.2 9/2/83
|
|
.TH REGCMP 1 "17 April 1986"
|
|
.SH NAME
|
|
regcmp \- regular expression compile
|
|
.SH SYNOPSIS
|
|
.B /usr/5bin/regcmp
|
|
[
|
|
.B \-
|
|
]
|
|
.I files
|
|
.SH DESCRIPTION
|
|
.IP Note:
|
|
Optional Software (System V Option).
|
|
Refer to
|
|
.I Installing \s-2UNIX\s0 on the Sun Workstation
|
|
for information on how to install this command.
|
|
.LP
|
|
.IR regcmp ,
|
|
in most cases, precludes
|
|
the need
|
|
for calling
|
|
.IR regcmp (3X)
|
|
from
|
|
.B 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
|
|
.RB ( C
|
|
variable) followed by one or more blanks followed by
|
|
a regular expression enclosed in double quotes. The output of
|
|
.I regcmp
|
|
is
|
|
.B C
|
|
source code. Compiled regular expressions are represented as
|
|
.B "extern char"
|
|
vectors.
|
|
.IB file .i
|
|
files may thus be
|
|
.I included
|
|
into
|
|
.B C
|
|
programs, or
|
|
.IB file .c
|
|
files may be compiled and later loaded. In the
|
|
.B C
|
|
program using
|
|
.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
|
|
.B 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
|
|
regcmp(3X)
|