diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 14:23:38 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 14:23:38 (GMT) |
commit | 45beb64f7dcb09a6ce83532702bca760f72e6f4d (patch) | |
tree | f7746a2a8316d612570e1456524e3d182e855c82 /doc/regexp.n | |
parent | 5bc57d7b0f63d86fc383565d69f7704943fff94d (diff) | |
download | tcl-45beb64f7dcb09a6ce83532702bca760f72e6f4d.zip tcl-45beb64f7dcb09a6ce83532702bca760f72e6f4d.tar.gz tcl-45beb64f7dcb09a6ce83532702bca760f72e6f4d.tar.bz2 |
Yet more doc update backporting
Diffstat (limited to 'doc/regexp.n')
-rw-r--r-- | doc/regexp.n | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/doc/regexp.n b/doc/regexp.n index 4309d26..42dc589 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.12 2002/10/10 14:46:57 dgp Exp $ +'\" RCS: @(#) $Id: regexp.n,v 1.12.2.1 2004/10/27 14:23:57 dkf Exp $ '\" .so man.macros .TH regexp n 8.3 Tcl "Tcl Built-In Commands" @@ -126,6 +126,33 @@ in \fIexp\fR doesn't match the string (e.g. because it was in a portion of the expression that wasn't matched), then the corresponding \fIsubMatchVar\fR will be set to ``\fB\-1 \-1\fR'' if \fB\-indices\fR has been specified or to an empty string otherwise. +.SH EXAMPLES +Find the first occurrence of a word starting with \fBfoo\fR in a +string that is not actually an instance of \fBfoobar\fR, and get the +letters following it up to the end of the word into a variable: +.CS +\fBregexp\fR {\\<foo(?!bar\\>)(\\w*)} $string \-> restOfWord +.CE +Note that the whole matched substring has been placed in the variable +\fB\->\fR which is a name chosen to look nice given that we are not +actually interested in its contents. +.PP +Find the index of the word \fBbadger\fR (in any case) within a string +and store that in the variable \fBlocation\fR: +.CS +\fBregexp\fR \-indices {(?i)\\<badger\\>} $string location +.CE +.PP +Count the number of octal digits in a string: +.CS +\fBregexp\fR \-all {[0\-7]} $string +.CE +.PP +List all words (consisting of all sequences of non-whitespace +characters) in a string: +.CS +\fBregexp\fR \-all \-inline {\\S+} $string +.CE .SH "SEE ALSO" re_syntax(n), regsub(n) |