OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [regsub.n] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1993 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: regsub.n,v 1.1.1.1 2002-01-16 10:25:25 markom Exp $
9
'\"
10
.so man.macros
11
.TH regsub n 7.4 Tcl "Tcl Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
regsub \- Perform substitutions based on regular expression pattern matching
16
.SH SYNOPSIS
17
\fBregsub \fR?\fIswitches\fR? \fIexp string subSpec varName\fR
18
.BE
19
 
20
.SH DESCRIPTION
21
.PP
22
This command matches the regular expression \fIexp\fR against
23
\fIstring\fR,
24
and it copies \fIstring\fR to the variable whose name is
25
given by \fIvarName\fR.
26
If there is a match, then while copying \fIstring\fR to \fIvarName\fR
27
the portion of \fIstring\fR that
28
matched \fIexp\fR is replaced with \fIsubSpec\fR.
29
If \fIsubSpec\fR contains a ``&'' or ``\e0'', then it is replaced
30
in the substitution with the portion of \fIstring\fR that
31
matched \fIexp\fR.
32
If \fIsubSpec\fR contains a ``\e\fIn\fR'', where \fIn\fR is a digit
33
between 1 and 9, then it is replaced in the substitution with
34
the portion of \fIstring\fR that matched the \fIn\fR-th
35
parenthesized subexpression of \fIexp\fR.
36
Additional backslashes may be used in \fIsubSpec\fR to prevent special
37
interpretation of ``&'' or ``\e0'' or ``\e\fIn\fR'' or
38
backslash.
39
The use of backslashes in \fIsubSpec\fR tends to interact badly
40
with the Tcl parser's use of backslashes, so it's generally
41
safest to enclose \fIsubSpec\fR in braces if it includes
42
backslashes.
43
.LP
44
If the initial arguments to \fBregexp\fR start with \fB\-\fR then
45
they are treated as switches.  The following switches are
46
currently supported:
47
.TP 10
48
\fB\-all\fR
49
All ranges in \fIstring\fR that match \fIexp\fR are found and
50
substitution is performed for each of these ranges.
51
Without this switch only the first
52
matching range is found and substituted.
53
If \fB\-all\fR is specified, then ``&'' and ``\e\fIn\fR''
54
sequences are handled for each substitution using the information
55
from the corresponding match.
56
.TP 10
57
\fB\-nocase\fR
58
Upper-case characters in \fIstring\fR will be converted to lower-case
59
before matching against \fIexp\fR;  however, substitutions specified
60
by \fIsubSpec\fR use the original unconverted form of \fIstring\fR.
61
.TP 10
62
\fB\-\|\-\fR
63
Marks the end of switches.  The argument following this one will
64
be treated as \fIexp\fR even if it starts with a \fB\-\fR.
65
.PP
66
The command returns a count of the number of matching ranges that
67
were found and replaced.
68
See the manual entry for \fBregexp\fR for details on the interpretation
69
of regular expressions.
70
 
71
.SH KEYWORDS
72
match, pattern, regular expression, substitute

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.