OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / man / man3 / Tcl_RegExpCompile.3
index b1d2511..ed43ec2 100644 (file)
@@ -6,76 +6,81 @@
 '\" See the file "license.terms" for information on usage and redistribution
 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 '\" 
-'\" RCS: @(#) $Id: RegExp.3,v 1.13 2002/11/13 22:11:40 vincentdarley Exp $
-'\" 
-'\" The definitions below are for supplemental macros used in Tcl/Tk
-'\" manual entries.
-'\"
-'\" .AP type name in/out ?indent?
-'\"    Start paragraph describing an argument to a library procedure.
-'\"    type is type of argument (int, etc.), in/out is either "in", "out",
-'\"    or "in/out" to describe whether procedure reads or modifies arg,
-'\"    and indent is equivalent to second arg of .IP (shouldn't ever be
-'\"    needed;  use .AS below instead)
-'\"
-'\" .AS ?type? ?name?
-'\"    Give maximum sizes of arguments for setting tab stops.  Type and
-'\"    name are examples of largest possible arguments that will be passed
-'\"    to .AP later.  If args are omitted, default tab stops are used.
-'\"
-'\" .BS
-'\"    Start box enclosure.  From here until next .BE, everything will be
-'\"    enclosed in one large box.
-'\"
-'\" .BE
-'\"    End of box enclosure.
-'\"
-'\" .CS
-'\"    Begin code excerpt.
-'\"
-'\" .CE
-'\"    End code excerpt.
-'\"
-'\" .VS ?version? ?br?
-'\"    Begin vertical sidebar, for use in marking newly-changed parts
-'\"    of man pages.  The first argument is ignored and used for recording
-'\"    the version when the .VS was added, so that the sidebars can be
-'\"    found and removed when they reach a certain age.  If another argument
-'\"    is present, then a line break is forced before starting the sidebar.
-'\"
-'\" .VE
-'\"    End of vertical sidebar.
-'\"
-'\" .DS
-'\"    Begin an indented unfilled display.
-'\"
-'\" .DE
-'\"    End of indented unfilled display.
-'\"
-'\" .SO
-'\"    Start of list of standard options for a Tk widget.  The
-'\"    options follow on successive lines, in four columns separated
-'\"    by tabs.
-'\"
-'\" .SE
-'\"    End of list of standard options for a Tk widget.
-'\"
-'\" .OP cmdName dbName dbClass
-'\"    Start of description of a specific option.  cmdName gives the
-'\"    option's name as specified in the class command, dbName gives
-'\"    the option's name in the option database, and dbClass gives
-'\"    the option's class in the option database.
-'\"
-'\" .UL arg1 arg2
-'\"    Print arg1 underlined, then print arg2 normally.
-'\"
-'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
-'\"
-'\"    # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
+.TH Tcl_RegExpMatch 3 8.1 Tcl "Tcl Library Procedures"
+.\" The -*- nroff -*- definitions below are for supplemental macros used
+.\" in Tcl/Tk manual entries.
+.\"
+.\" .AP type name in/out ?indent?
+.\"    Start paragraph describing an argument to a library procedure.
+.\"    type is type of argument (int, etc.), in/out is either "in", "out",
+.\"    or "in/out" to describe whether procedure reads or modifies arg,
+.\"    and indent is equivalent to second arg of .IP (shouldn't ever be
+.\"    needed;  use .AS below instead)
+.\"
+.\" .AS ?type? ?name?
+.\"    Give maximum sizes of arguments for setting tab stops.  Type and
+.\"    name are examples of largest possible arguments that will be passed
+.\"    to .AP later.  If args are omitted, default tab stops are used.
+.\"
+.\" .BS
+.\"    Start box enclosure.  From here until next .BE, everything will be
+.\"    enclosed in one large box.
+.\"
+.\" .BE
+.\"    End of box enclosure.
+.\"
+.\" .CS
+.\"    Begin code excerpt.
+.\"
+.\" .CE
+.\"    End code excerpt.
+.\"
+.\" .VS ?version? ?br?
+.\"    Begin vertical sidebar, for use in marking newly-changed parts
+.\"    of man pages.  The first argument is ignored and used for recording
+.\"    the version when the .VS was added, so that the sidebars can be
+.\"    found and removed when they reach a certain age.  If another argument
+.\"    is present, then a line break is forced before starting the sidebar.
+.\"
+.\" .VE
+.\"    End of vertical sidebar.
+.\"
+.\" .DS
+.\"    Begin an indented unfilled display.
+.\"
+.\" .DE
+.\"    End of indented unfilled display.
+.\"
+.\" .SO ?manpage?
+.\"    Start of list of standard options for a Tk widget. The manpage
+.\"    argument defines where to look up the standard options; if
+.\"    omitted, defaults to "options". The options follow on successive
+.\"    lines, in three columns separated by tabs.
+.\"
+.\" .SE
+.\"    End of list of standard options for a Tk widget.
+.\"
+.\" .OP cmdName dbName dbClass
+.\"    Start of description of a specific option.  cmdName gives the
+.\"    option's name as specified in the class command, dbName gives
+.\"    the option's name in the option database, and dbClass gives
+.\"    the option's class in the option database.
+.\"
+.\" .UL arg1 arg2
+.\"    Print arg1 underlined, then print arg2 normally.
+.\"
+.\" .QW arg1 ?arg2?
+.\"    Print arg1 in quotes, then arg2 normally (for trailing punctuation).
+.\"
+.\" .PQ arg1 ?arg2?
+.\"    Print an open parenthesis, arg1 in quotes, then arg2 normally
+.\"    (for trailing punctuation) and then a closing parenthesis.
+.\"
+.\"    # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
 .if t .wh -1.3i ^B
 .nr ^l \n(.l
 .ad b
-'\"    # Start an argument description
+.\"    # Start an argument description
 .de AP
 .ie !"\\$4"" .TP \\$4
 .el \{\
@@ -84,7 +89,7 @@
 .\}
 .ta \\n()Au \\n()Bu
 .ie !"\\$3"" \{\
-\&\\$1 \\fI\\$2\\fP    (\\$3)
+\&\\$1 \\fI\\$2\\fP (\\$3)
 .\".b
 .\}
 .el \{\
 .\}
 .\}
 ..
-'\"    # define tabbing values for .AP
+.\"    # define tabbing values for .AP
 .de AS
 .nr )A 10n
 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
 .nr )C \\n()Bu+\\w'(in/out)'u+2n
 ..
 .AS Tcl_Interp Tcl_CreateInterp in/out
-'\"    # BS - start boxed text
-'\"    # ^y = starting y location
-'\"    # ^b = 1
+.\"    # BS - start boxed text
+.\"    # ^y = starting y location
+.\"    # ^b = 1
 .de BS
 .br
 .mk ^y
 .if n \l'\\n(.lu\(ul'
 .if n .fi
 ..
-'\"    # BE - end boxed text (draw box now)
+.\"    # BE - end boxed text (draw box now)
 .de BE
 .nf
 .ti 0
 .br
 .nr ^b 0
 ..
-'\"    # VS - start vertical sidebar
-'\"    # ^Y = starting y location
-'\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
+.\"    # VS - start vertical sidebar
+.\"    # ^Y = starting y location
+.\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
 .de VS
 .if !"\\$2"" .br
 .mk ^Y
 .ie n 'mc \s12\(br\s0
 .el .nr ^v 1u
 ..
-'\"    # VE - end of vertical sidebar
+.\"    # VE - end of vertical sidebar
 .de VE
 .ie n 'mc
 .el \{\
 .\}
 .nr ^v 0
 ..
-'\"    # Special macro to handle page bottom:  finish off current
-'\"    # box/sidebar if in box/sidebar mode, then invoked standard
-'\"    # page bottom macro.
+.\"    # Special macro to handle page bottom:  finish off current
+.\"    # box/sidebar if in box/sidebar mode, then invoked standard
+.\"    # page bottom macro.
 .de ^B
 .ev 2
 'ti 0
 .mk ^Y
 .\}
 ..
-'\"    # DS - begin display
+.\"    # DS - begin display
 .de DS
 .RS
 .nf
 .sp
 ..
-'\"    # DE - end display
+.\"    # DE - end display
 .de DE
 .fi
 .RE
 .sp
 ..
-'\"    # SO - start of list of standard options
+.\"    # SO - start of list of standard options
 .de SO
+'ie '\\$1'' .ds So \\fBoptions\\fR
+'el .ds So \\fB\\$1\\fR
 .SH "STANDARD OPTIONS"
 .LP
 .nf
 .ta 5.5c 11c
 .ft B
 ..
-'\"    # SE - end of list of standard options
+.\"    # SE - end of list of standard options
 .de SE
 .fi
 .ft R
 .LP
-See the \\fBoptions\\fR manual entry for details on the standard options.
+See the \\*(So manual entry for details on the standard options.
 ..
-'\"    # OP - start of full description for a single option
+.\"    # OP - start of full description for a single option
 .de OP
 .LP
 .nf
@@ -230,21 +237,43 @@ Database Class:   \\fB\\$3\\fR
 .fi
 .IP
 ..
-'\"    # CS - begin code excerpt
+.\"    # CS - begin code excerpt
 .de CS
 .RS
 .nf
 .ta .25i .5i .75i 1i
 ..
-'\"    # CE - end code excerpt
+.\"    # CE - end code excerpt
 .de CE
 .fi
 .RE
 ..
+.\"    # UL - underline word
 .de UL
 \\$1\l'|0\(ul'\\$2
 ..
-.TH Tcl_RegExpMatch 3 8.1 Tcl "Tcl Library Procedures"
+.\"    # QW - apply quotation marks to word
+.de QW
+.ie '\\*(lq'"' ``\\$1''\\$2
+.\"" fix emacs highlighting
+.el \\*(lq\\$1\\*(rq\\$2
+..
+.\"    # PQ - apply parens and quotation marks to word
+.de PQ
+.ie '\\*(lq'"' (``\\$1''\\$2)\\$3
+.\"" fix emacs highlighting
+.el (\\*(lq\\$1\\*(rq\\$2)\\$3
+..
+.\"    # QR - quoted range
+.de QR
+.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
+.\"" fix emacs highlighting
+.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
+..
+.\"    # MT - "empty" string
+.de MT
+.QW ""
+..
 .BS
 .SH NAME
 Tcl_RegExpMatch, Tcl_RegExpCompile, Tcl_RegExpExec, Tcl_RegExpRange, Tcl_GetRegExpFromObj, Tcl_RegExpMatchObj, Tcl_RegExpExecObj, Tcl_RegExpGetInfo \- Pattern matching with regular expressions
@@ -253,93 +282,88 @@ Tcl_RegExpMatch, Tcl_RegExpCompile, Tcl_RegExpExec, Tcl_RegExpRange, Tcl_GetRegE
 \fB#include <tcl.h>\fR
 .sp
 int
-\fBTcl_RegExpMatchObj\fR(\fIinterp\fR, \fIstrObj\fR, \fIpatObj\fR)
+\fBTcl_RegExpMatchObj\fR(\fIinterp\fR, \fItextObj\fR, \fIpatObj\fR)
 .sp
 int
-\fBTcl_RegExpMatch\fR(\fIinterp\fR, \fIstring\fR, \fIpattern\fR)
+\fBTcl_RegExpMatch\fR(\fIinterp\fR, \fItext\fR, \fIpattern\fR)
 .sp
 Tcl_RegExp
 \fBTcl_RegExpCompile\fR(\fIinterp\fR, \fIpattern\fR)
 .sp
 int
-\fBTcl_RegExpExec\fR(\fIinterp\fR, \fIregexp\fR, \fIstring\fR, \fIstart\fR)
+\fBTcl_RegExpExec\fR(\fIinterp\fR, \fIregexp\fR, \fItext\fR, \fIstart\fR)
 .sp
+void
 \fBTcl_RegExpRange\fR(\fIregexp\fR, \fIindex\fR, \fIstartPtr\fR, \fIendPtr\fR)
-.VS 8.1
 .sp
 Tcl_RegExp
 \fBTcl_GetRegExpFromObj\fR(\fIinterp\fR, \fIpatObj\fR, \fIcflags\fR)
 .sp
 int
-\fBTcl_RegExpExecObj\fR(\fIinterp\fR, \fIregexp\fR, \fIobjPtr\fR, \fIoffset\fR, \fInmatches\fR, \fIeflags\fR)
+\fBTcl_RegExpExecObj\fR(\fIinterp\fR, \fIregexp\fR, \fItextObj\fR, \fIoffset\fR, \fInmatches\fR, \fIeflags\fR)
 .sp
+void
 \fBTcl_RegExpGetInfo\fR(\fIregexp\fR, \fIinfoPtr\fR)
-.VE 8.1
-
+.fi
 .SH ARGUMENTS
-.AS Tcl_Interp *interp
+.AS Tcl_RegExpInfo *interp in/out
 .AP Tcl_Interp *interp in
 Tcl interpreter to use for error reporting.  The interpreter may be
 NULL if no error reporting is desired.
-.VS 8.1
-.AP Tcl_Obj *strObj in/out
-Refers to the object from which to get the string to search.  The
-internal representation of the object may be converted to a form that
+.AP Tcl_Obj *textObj in/out
+Refers to the value from which to get the text to search.  The
+internal representation of the value may be converted to a form that
 can be efficiently searched.
 .AP Tcl_Obj *patObj in/out
-Refers to the object from which to get a regular expression. The
-compiled regular expression is cached in the object.
-.VE 8.1
-.AP char *string in
-String to check for a match with a regular expression.
-.AP "CONST char" *pattern in
+Refers to the value from which to get a regular expression. The
+compiled regular expression is cached in the value.
+.AP char *text in
+Text to search for a match with a regular expression.
+.AP "const char" *pattern in
 String in the form of a regular expression pattern.
 .AP Tcl_RegExp regexp in
 Compiled regular expression.  Must have been returned previously
 by \fBTcl_GetRegExpFromObj\fR or \fBTcl_RegExpCompile\fR.
 .AP char *start in
-If \fIstring\fR is just a portion of some other string, this argument
+If \fItext\fR is just a portion of some other string, this argument
 identifies the beginning of the larger string.
-If it isn't the same as \fIstring\fR, then no \fB^\fR matches
-will be allowed.
+If it is not the same as \fItext\fR, then no
+.QW \fB^\fR
+matches will be allowed.
 .AP int index in
 Specifies which range is desired:  0 means the range of the entire
 match, 1 or greater means the range that matched a parenthesized
 sub-expression.
-.VS 8.4
-.AP "CONST char" **startPtr out
+.AP "const char" **startPtr out
 The address of the first character in the range is stored here, or
 NULL if there is no such range.
-.AP "CONST char" **endPtr out
+.AP "const char" **endPtr out
 The address of the character just after the last one in the range
 is stored here, or NULL if there is no such range.
-.VE 8.4
-.VS 8.1
 .AP int cflags in
-OR-ed combination of compilation flags. See below for more information.
-.AP Tcl_Obj *objPtr in/out
-An object which contains the string to check for a match with a
-regular expression.
+OR-ed combination of the compilation flags \fBTCL_REG_ADVANCED\fR,
+\fBTCL_REG_EXTENDED\fR, \fBTCL_REG_BASIC\fR, \fBTCL_REG_EXPANDED\fR,
+\fBTCL_REG_QUOTE\fR, \fBTCL_REG_NOCASE\fR, \fBTCL_REG_NEWLINE\fR,
+\fBTCL_REG_NLSTOP\fR, \fBTCL_REG_NLANCH\fR, \fBTCL_REG_NOSUB\fR, and
+\fBTCL_REG_CANMATCH\fR. See below for more information.
 .AP int offset in
-The character offset into the string where matching should begin.
+The character offset into the text where matching should begin.
 The value of the offset has no impact on \fB^\fR matches.  This
 behavior is controlled by \fIeflags\fR.
 .AP int nmatches in
 The number of matching subexpressions that should be remembered for
 later use.  If this value is 0, then no subexpression match
-information will be computed.  If the value is -1, then
+information will be computed.  If the value is \-1, then
 all of the matching subexpressions will be remembered.  Any other
 value will be taken as the maximum number of subexpressions to
 remember.
 .AP int eflags in
-OR-ed combination of the values TCL_REG_NOTBOL and TCL_REG_NOTEOL.
-See below for more information.
+OR-ed combination of the execution flags \fBTCL_REG_NOTBOL\fR and
+\fBTCL_REG_NOTEOL\fR. See below for more information.
 .AP Tcl_RegExpInfo *infoPtr out
 The address of the location where information about a previous match
 should be stored by \fBTcl_RegExpGetInfo\fR.
-.VE 8.1
 .BE
-
 .SH DESCRIPTION
 .PP
 \fBTcl_RegExpMatch\fR determines whether its \fIpattern\fR argument
@@ -351,13 +375,11 @@ If there is no match then \fBTcl_RegExpMatch\fR returns 0.
 If an error occurs in the matching process (e.g. \fIpattern\fR
 is not a valid regular expression) then \fBTcl_RegExpMatch\fR
 returns \-1 and leaves an error message in the interpreter result.
-.VS 8.1.2
 \fBTcl_RegExpMatchObj\fR is similar to \fBTcl_RegExpMatch\fR except it
-operates on the Tcl objects \fIstrObj\fR and \fIpatObj\fR instead of
+operates on the Tcl values \fItextObj\fR and \fIpatObj\fR instead of
 UTF strings. 
 \fBTcl_RegExpMatchObj\fR is generally more efficient than
 \fBTcl_RegExpMatch\fR, so it is the preferred interface.
-.VE 8.1.2
 .PP
 \fBTcl_RegExpCompile\fR, \fBTcl_RegExpExec\fR, and \fBTcl_RegExpRange\fR
 provide lower-level access to the regular expression pattern matcher.
@@ -373,7 +395,7 @@ up to the next call to \fBTcl_RegExpCompile\fR;  it is not safe to
 retain these values for long periods of time.
 .PP
 \fBTcl_RegExpExec\fR executes the regular expression pattern matcher.
-It returns 1 if \fIstring\fR contains a range of characters that
+It returns 1 if \fItext\fR contains a range of characters that
 match \fIregexp\fR, 0 if no match is found, and
 \-1 if an error occurs.
 In the case of an error, \fBTcl_RegExpExec\fR leaves an error
@@ -382,14 +404,16 @@ When searching a string for multiple matches of a pattern,
 it is important to distinguish between the start of the original
 string and the start of the current search.
 For example, when searching for the second occurrence of a
-match, the \fIstring\fR argument might point to the character
+match, the \fItext\fR argument might point to the character
 just after the first match;  however, it is important for the
 pattern matcher to know that this is not the start of the entire string,
-so that it doesn't allow \fB^\fR atoms in the pattern to match.
+so that it does not allow
+.QW \fB^\fR
+atoms in the pattern to match.
 The \fIstart\fR argument provides this information by pointing
-to the start of the overall string containing \fIstring\fR.
-\fIStart\fR will be less than or equal to \fIstring\fR;  if it
-is less than \fIstring\fR then no \fB^\fR matches will be allowed.
+to the start of the overall string containing \fItext\fR.
+\fIStart\fR will be less than or equal to \fItext\fR;  if it
+is less than \fItext\fR then no \fB^\fR matches will be allowed.
 .PP
 \fBTcl_RegExpRange\fR may be invoked after \fBTcl_RegExpExec\fR
 returns;  it provides detailed information about what ranges of
@@ -405,20 +429,19 @@ information is returned about the range of characters that matched the
 If there is no range corresponding to \fIindex\fR then NULL
 is stored in \fI*startPtr\fR and \fI*endPtr\fR.
 .PP
-.VS 8.1
 \fBTcl_GetRegExpFromObj\fR, \fBTcl_RegExpExecObj\fR, and
-\fBTcl_RegExpGetInfo\fR are object interfaces that provide the most
+\fBTcl_RegExpGetInfo\fR are value interfaces that provide the most
 direct control of Henry Spencer's regular expression library.  For
 users that need to modify compilation and execution options directly,
 it is recommended that you use these interfaces instead of calling the
 internal regexp functions.  These interfaces handle the details of UTF
 to Unicode translations as well as providing improved performance
-through caching in the pattern and string objects.
+through caching in the pattern and string values.
 .PP
 \fBTcl_GetRegExpFromObj\fR attempts to return a compiled regular
-expression from the \fIpatObj\fR.  If the object does not already
+expression from the \fIpatObj\fR.  If the value does not already
 contain a compiled regular expression it will attempt to create one
-from the string in the object and assign it to the internal
+from the string in the value and assign it to the internal
 representation of the \fIpatObj\fR.  The return value of this function
 is of type \fBTcl_RegExp\fR.  The return value is a token for this
 compiled form, which can be used in subsequent calls to
@@ -427,23 +450,29 @@ occurs while compiling the regular expression then
 \fBTcl_GetRegExpFromObj\fR returns NULL and leaves an error message in
 the interpreter result.  The regular expression token can be used as
 long as the internal representation of \fIpatObj\fR refers to the
-compiled form.  The \fIeflags\fR argument is a bitwise OR of
+compiled form.  The \fIcflags\fR argument is a bit-wise OR of
 zero or more of the following flags that control the compilation of
 \fIpatObj\fR:
 .RS 2
 .TP
 \fBTCL_REG_ADVANCED\fR
-Compile advanced regular expressions (`AREs').  This mode corresponds to
-the normal regular expression syntax accepted by the Tcl regexp and
-regsub commands.
+Compile advanced regular expressions
+.PQ ARE s .
+This mode corresponds to
+the normal regular expression syntax accepted by the Tcl \fBregexp\fR and
+\fBregsub\fR commands.
 .TP
 \fBTCL_REG_EXTENDED\fR
-Compile extended regular expressions (`EREs').  This mode corresponds
+Compile extended regular expressions
+.PQ ERE s .
+This mode corresponds
 to the regular expression syntax recognized by Tcl 8.0 and earlier
 versions. 
 .TP
 \fBTCL_REG_BASIC\fR
-Compile basic regular expressions (`BREs').  This mode corresponds
+Compile basic regular expressions
+.PQ BRE s .
+This mode corresponds
 to the regular expression syntax recognized by common Unix utilities
 like \fBsed\fR and \fBgrep\fR.  This is the default if no flags are
 specified.
@@ -463,26 +492,54 @@ Compile for matching that ignores upper/lower case distinctions.
 \fBTCL_REG_NEWLINE\fR
 Compile for newline-sensitive matching.  By default, newline is a
 completely ordinary character with no special meaning in either
-regular expressions or strings.  With this flag, `[^' bracket
-expressions and `.' never match newline, `^' matches an empty string
-after any newline in addition to its normal function, and `$' matches
+regular expressions or strings.  With this flag,
+.QW [^
+bracket expressions and
+.QW .
+never match newline,
+.QW ^
+matches an empty string
+after any newline in addition to its normal function, and
+.QW $
+matches
 an empty string before any newline in addition to its normal function.
-\fBREG_NEWLINE\fR is the bitwise OR of \fBREG_NLSTOP\fR and
+\fBREG_NEWLINE\fR is the bit-wise OR of \fBREG_NLSTOP\fR and
 \fBREG_NLANCH\fR.
 .TP
 \fBTCL_REG_NLSTOP\fR
 Compile for partial newline-sensitive matching,
 with the behavior of
-`[^' bracket expressions and `.' affected,
-but not the behavior of `^' and `$'.  In this mode, `[^' bracket
-expressions and `.' never match newline.
+.QW [^
+bracket expressions and
+.QW .
+affected, but not the behavior of
+.QW ^
+and
+.QW $ .
+In this mode,
+.QW [^
+bracket expressions and
+.QW .
+never match newline.
 .TP
 \fBTCL_REG_NLANCH\fR
 Compile for inverse partial newline-sensitive matching,
 with the behavior of
-of `^' and `$' (the ``anchors'') affected, but not the behavior of
-`[^' bracket expressions and `.'.  In this mode `^' matches an empty string
-after any newline in addition to its normal function, and `$' matches
+.QW ^
+and
+.QW $
+(the
+.QW anchors )
+affected, but not the behavior of
+.QW [^
+bracket expressions and
+.QW . .
+In this mode
+.QW ^
+matches an empty string
+after any newline in addition to its normal function, and
+.QW $
+matches
 an empty string before any newline in addition to its normal function.
 .TP
 \fBTCL_REG_NOSUB\fR
@@ -510,25 +567,33 @@ error message in the interpreter result.  The \fInmatches\fR value
 indicates to the matcher how many subexpressions are of interest.  If
 \fInmatches\fR is 0, then no subexpression match information is
 recorded, which may allow the matcher to make various optimizations.
-If the value is -1, then all of the subexpressions in the pattern are
+If the value is \-1, then all of the subexpressions in the pattern are
 remembered.  If the value is a positive integer, then only that number
 of subexpressions will be remembered.  Matching begins at the
 specified Unicode character index given by \fIoffset\fR.  Unlike
 \fBTcl_RegExpExec\fR, the behavior of anchors is not affected by the
 offset value.  Instead the behavior of the anchors is explicitly
-controlled by the \fIeflags\fR argument, which is a bitwise OR of
+controlled by the \fIeflags\fR argument, which is a bit-wise OR of
 zero or more of the following flags:
 .RS 2
 .TP
 \fBTCL_REG_NOTBOL\fR
 The starting character will not be treated as the beginning of a
-line or the beginning of the string, so `^' will not match there.
-Note that this flag has no effect on how `\fB\eA\fR' matches.
+line or the beginning of the string, so
+.QW ^
+will not match there.
+Note that this flag has no effect on how
+.QW \fB\eA\fR
+matches.
 .TP
 \fBTCL_REG_NOTEOL\fR
 The last character in the string will not be treated as the end of a
-line or the end of the string, so '$' will not match there.
-Note that this flag has no effect on how `\fB\eZ\fR' matches.
+line or the end of the string, so
+.QW $
+will not match there.
+Note that this flag has no effect on how
+.QW \fB\eZ\fR
+matches.
 .RE
 .PP
 \fBTcl_RegExpGetInfo\fR retrieves information about the last match
@@ -538,16 +603,16 @@ defined as follows:
 .PP
 .CS
 typedef struct Tcl_RegExpInfo {
-       int \fInsubs\fR;
-       Tcl_RegExpIndices *\fImatches\fR;
-       long \fIextendStart\fR;
-} Tcl_RegExpInfo;
+    int \fInsubs\fR;
+    Tcl_RegExpIndices *\fImatches\fR;
+    long \fIextendStart\fR;
+} \fBTcl_RegExpInfo\fR;
 .CE
 .PP
 The \fInsubs\fR field contains a count of the number of parenthesized
 subexpressions within the regular expression.  If the \fBTCL_REG_NOSUB\fR
 was used, then this value will be zero.  The \fImatches\fR field
-points to an array of \fInsubs\fR values that indicate the bounds of each
+points to an array of \fInsubs\fR+1 values that indicate the bounds of each
 subexpression matched.  The first element in the array refers to the
 range matched by the entire regular expression, and subsequent elements
 refer to the parenthesized subexpressions in the order that they
@@ -556,9 +621,9 @@ follows:
 .PP
 .CS
 typedef struct Tcl_RegExpIndices {
-       long \fIstart\fR;
-       long \fIend\fR;
-} Tcl_RegExpIndices;
+    long \fIstart\fR;
+    long \fIend\fR;
+} \fBTcl_RegExpIndices\fR;
 .CE
 .PP
 The \fIstart\fR and \fIend\fR values are Unicode character indices
@@ -568,7 +633,7 @@ subexpression.  The \fIend\fR index identifies the first character
 after the matched subexpression.  If the subexpression matched the
 empty string, then \fIstart\fR and \fIend\fR will be equal.  If the
 subexpression did not participate in the match, then \fIstart\fR and
-\fIend\fR will be set to -1.
+\fIend\fR will be set to \-1.
 .PP
 The \fIextendStart\fR field in \fBTcl_RegExpInfo\fR is only set if the
 \fBTCL_REG_CANMATCH\fR flag was used.  It indicates the first
@@ -577,8 +642,7 @@ found, this will be the same as the beginning of the current match.
 If no match was found, then it indicates the earliest point at which a
 match might occur if additional text is appended to the string.  If it
 is no match is possible even with further text, this field will be set 
-to -1.
-.VE 8.1
+to \-1.
 .SH "SEE ALSO"
 re_syntax(n)
 .SH KEYWORDS