summaryrefslogtreecommitdiff
path: root/usr/src/man/man3gen/regexpr.3gen
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man/man3gen/regexpr.3gen')
-rw-r--r--usr/src/man/man3gen/regexpr.3gen38
1 files changed, 12 insertions, 26 deletions
diff --git a/usr/src/man/man3gen/regexpr.3gen b/usr/src/man/man3gen/regexpr.3gen
index ba5a2e3f6d..1e348b6173 100644
--- a/usr/src/man/man3gen/regexpr.3gen
+++ b/usr/src/man/man3gen/regexpr.3gen
@@ -3,12 +3,11 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH REGEXPR 3GEN "Dec 29, 1996"
+.TH REGEXPR 3GEN "June 18, 2021"
.SH NAME
regexpr, compile, step, advance \- regular expression compile and match
routines
.SH SYNOPSIS
-.LP
.nf
\fBcc\fR [\fIflag\fR]... [\fIfile\fR]... \fB-lgen\fR [\fIlibrary\fR]...
.fi
@@ -48,8 +47,6 @@ routines
.fi
.SH DESCRIPTION
-.sp
-.LP
These routines are used to compile regular expressions and match the compiled
expressions against lines. The regular expressions compiled are in the form
used by \fBed\fR(1).
@@ -74,7 +71,7 @@ compiled regular expression may be placed. This argument is ignored if
\fBregerrno\fR (see below) is set to 50.
.sp
.LP
-The parameter \fIstring\fR is a pointer to a string of characters to be
+The parameter \fIstring\fR is a pointer to a string of characters to be
checked for a match. This string should be null-terminated.
.sp
.LP
@@ -85,7 +82,7 @@ call of the function \fBcompile()\fR.
The function \fBstep()\fR returns non-zero if the given string matches the
regular expression, and zero if the expressions do not match. If there is a
match, two external character pointers are set as a side effect to the call to
-\fBstep()\fR. The variables set in \fBstep()\fR are \fIloc1\fR and \fIloc2\fR.
+\fBstep()\fR. The variables set in \fBstep()\fR are \fIloc1\fR and \fIloc2\fR.
\fIloc1\fR is a pointer to the first character that matched the regular
expression. The variable \fIloc2\fR points to the character after the last
character that matches the regular expression. Thus if the regular expression
@@ -99,8 +96,8 @@ expression begins with \fB^\fR, \fBstep()\fR tries to match the regular
expression at the beginning of the string only.
.sp
.LP
-The \fBadvance()\fR function is similar to \fBstep()\fR; but, it only sets the
-variable \fIloc2\fR and always restricts matches to the beginning of the
+The \fBadvance()\fR function is similar to \fBstep()\fR; but, it only sets the
+variable \fIloc2\fR and always restricts matches to the beginning of the
string.
.sp
.LP
@@ -114,11 +111,11 @@ loop forever, and is \fINULL\fR by default.
The external variable \fBnbra\fR is used to determine the number of
subexpressions in the compiled regular expression. \fBbraslist\fR and
\fBbraelist\fR are arrays of character pointers that point to the start and end
-of the \fBnbra\fR subexpressions in the matched string. For example, after
+of the \fBnbra\fR subexpressions in the matched string. For example, after
calling \fBstep()\fR or \fBadvance()\fR with string \fBsabcdefg\fR and regular
-expression \fB\e(abcdef\e)\fR, \fBbraslist[0]\fR will point at \fBa\fR and
+expression \fB\e(abcdef\e)\fR, \fBbraslist[0]\fR will point at \fBa\fR and
\fBbraelist[0]\fR will point at \fBg\fR. These arrays are used by commands like
-\fBed\fR and \fBsed\fR for substitute replacement patterns that contain the
+\fBed\fR and \fBsed\fR for substitute replacement patterns that contain the
\fB\e\fR\fIn\fR notation for subexpressions.
.sp
.LP
@@ -127,13 +124,12 @@ Note that it is not necessary to use the external variables \fBregerrno\fR,
\fBbraslist\fR if one is only checking whether or not a string matches a
regular expression.
.SH EXAMPLES
-.LP
\fBExample 1 \fRThe following is similar to the regular expression code from
\fBgrep\fR:
.sp
.in +2
.nf
-#include<regexpr.h>
+#include <regexpr.h>
\&...
if(compile(*argv, (char *)0, (char *)0) == (char *)0)
regerr(regerrno);
@@ -144,12 +140,10 @@ if (step(linebuf, expbuf))
.in -2
.SH RETURN VALUES
-.sp
-.LP
If \fBcompile()\fR succeeds, it returns a non-\fINULL\fR pointer whose value
depends on \fIexpbuf\fR. If \fIexpbuf\fR is non-\fINULL\fR, \fBcompile()\fR
-returns a pointer to the byte after the last byte in the compiled regular
-expression. The length of the compiled regular expression is stored in
+returns a pointer to the byte after the last byte in the compiled regular
+expression. The length of the compiled regular expression is stored in
\fBreglength\fR. Otherwise, \fBcompile()\fR returns a pointer to the space
allocated by \fBmalloc\fR(3C).
.sp
@@ -158,8 +152,6 @@ The functions \fBstep()\fR and \fBadvance()\fR return non-zero if the given
string matches the regular expression, and zero if the expressions do not
match.
.SH ERRORS
-.sp
-.LP
If an error is detected when compiling the regular expression, a \fINULL\fR
pointer is returned from \fBcompile()\fR and \fBregerrno\fR is set to one of
the non-zero error numbers indicated below:
@@ -181,12 +173,10 @@ ERROR MEANING
45 } expected after \e.
46 First number exceeds second in \e{~\e}.
49 [] imbalance.
-50 Regular expression overflow.
+50 Regular expression overflow.
.TE
.SH ATTRIBUTES
-.sp
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -201,13 +191,9 @@ MT-Level MT-Safe
.TE
.SH SEE ALSO
-.sp
-.LP
\fBed\fR(1), \fBgrep\fR(1), \fBsed\fR(1), \fBmalloc\fR(3C),
\fBattributes\fR(5), \fBregexp\fR(5)
.SH NOTES
-.sp
-.LP
When compiling multi-threaded applications, the \fB_REENTRANT\fR flag must be
defined on the compile line. This flag should only be used in multi-threaded
applications.