summaryrefslogtreecommitdiffstats
path: root/doc/regexp.n
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-02-02 22:32:07 (GMT)
committerhobbs <hobbs>2000-02-02 22:32:07 (GMT)
commit249c0cdd339420c04f811985d70a1e28cd40e9d9 (patch)
tree4385fdf7ff72732b8da6acdd0cec31c3d5d7fab4 /doc/regexp.n
parent178a952f93e48b971bbd9767f1665c47ce5b0c2f (diff)
downloadtcl-249c0cdd339420c04f811985d70a1e28cd40e9d9.zip
tcl-249c0cdd339420c04f811985d70a1e28cd40e9d9.tar.gz
tcl-249c0cdd339420c04f811985d70a1e28cd40e9d9.tar.bz2
* tests/regexp.test: added tests for -all and -inline switches
* doc/regexp.n: added docs for -all and -inline switches * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): added extra comments for new -all and -inline switches to regexp command
Diffstat (limited to 'doc/regexp.n')
-rw-r--r--doc/regexp.n56
1 files changed, 38 insertions, 18 deletions
diff --git a/doc/regexp.n b/doc/regexp.n
index 3b19420..373691a 100644
--- a/doc/regexp.n
+++ b/doc/regexp.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: regexp.n,v 1.7 1999/09/21 04:20:36 hobbs Exp $
+'\" RCS: @(#) $Id: regexp.n,v 1.8 2000/02/02 22:32:09 hobbs Exp $
'\"
.so man.macros
.TH regexp n 8.3 Tcl "Tcl Built-In Commands"
@@ -20,7 +20,8 @@ regexp \- Match a regular expression against a string
.SH DESCRIPTION
.PP
Determines whether the regular expression \fIexp\fR matches part or
-all of \fIstring\fR and returns 1 if it does, 0 if it doesn't.
+all of \fIstring\fR and returns 1 if it does, 0 if it doesn't, unless
+\fB-inline\fR is specified (see below).
(Regular expression matching is described in the \fBre_syntax\fR
reference page.)
.LP
@@ -38,9 +39,17 @@ If the initial arguments to \fBregexp\fR start with \fB\-\fR then
they are treated as switches. The following switches are
currently supported:
.TP 15
-\fB\-nocase\fR
-Causes upper-case characters in \fIstring\fR to be treated as
-lower case during the matching process.
+\fB\-about\fR
+Instead of attempting to match the regular expression, returns a list
+containing information about the regular expression. The first
+element of the list is a subexpression count. The second element is a
+list of property names that describe various attributes of the regular
+expression. This switch is primarily intended for debugging purposes.
+.TP 15
+\fB\-expanded\fR
+Enables use of the expanded regular expression syntax where
+whitespace and comments are ignored. This is the same as specifying
+the \fB(?x)\fR embedded option (see METASYNTAX, below).
.TP 15
\fB\-indices\fR
Changes what is stored in the \fIsubMatchVar\fRs.
@@ -49,12 +58,6 @@ each variable
will contain a list of two decimal strings giving the indices
in \fIstring\fR of the first and last characters in the matching
range of characters.
-.VS 8.1
-.TP 15
-\fB\-expanded\fR
-Enables use of the expanded regular expression syntax where
-whitespace and comments are ignored. This is the same as specifying
-the \fB(?x)\fR embedded option (see METASYNTAX, below).
.TP 15
\fB\-line\fR
Enables newline-sensitive matching. By default, newline is a
@@ -76,15 +79,32 @@ Changes the behavior of `^' and `$' (the ``anchors'') so they match the
beginning and end of a line respectively. This is the same as
specifying the \fB(?w)\fR embedded option (see METASYNTAX, below).
.TP 15
-\fB\-about\fR
-Instead of attempting to match the regular expression, returns a list
-containing information about the regular expression. The first
-element of the list is a subexpression count. The second element is a
-list of property names that describe various attributes of the regular
-expression. This switch is primarily intended for debugging purposes.
-.VE 8.1
+\fB\-nocase\fR
+Causes upper-case characters in \fIstring\fR to be treated as
+lower case during the matching process.
.VS 8.3
.TP 15
+\fB\-all\fR
+Causes the regular expression to be matched as many times as possible
+in the string, returning the total number of matches found. If this
+is specified with match variables, they will continue information for
+the last match only.
+.TP 15
+\fB\-inline\fR
+Causes the command to return the data that would otherwise be placed
+in match variables to be returned as a list. When using \fB-inline\fR,
+match variables may not be specified. If used with \fB-all\fR, the
+list will be concatenated at each iteration, such that a flat list is
+always returned. For each match iteration, the command will append the
+overall match data, plus one element for each subexpression in the
+regular expression. Examples are:
+.CS
+ regexp -inline -- {\\w(\\w)} " inlined "
+ => {in n}
+ regexp -all -inline -- {\\w(\\w)} " inlined "
+ => {in n li i ne e}
+.CE
+.TP 15
\fB\-start\fR \fIindex\fR
Specifies a character index offset into the string to start
matching the regular expression at. When using this switch, `^'