1mNAME0m
       re_syntax - Syntax of Tcl regular expressions.


1mDESCRIPTION0m
       A  4mregular24m  4mexpression24m describes strings of characters.  It's a pattern
       that matches certain strings and doesn't match others.


1mDIFFERENT FLAVORS OF REs0m
       Regular expressions (``RE''s), as defined by POSIX, come  in  two  fla-
       vors:  4mextended24m  REs  (``EREs'')  and  4mbasic24m  REs (``BREs'').  EREs are
       roughly those of the traditional 4megrep24m, while BREs are roughly those of
       the  traditional 4med24m.  This implementation adds a third flavor, 4madvanced0m
       REs (``AREs''), basically EREs with some significant extensions.

       This manual page primarily describes AREs.  BREs mostly exist for back-
       ward  compatibility in some old programs; they will be discussed at the
       end.  POSIX EREs are almost an exact subset of AREs.  Features of  AREs
       that are not present in EREs will be indicated.


1mREGULAR EXPRESSION SYNTAX0m
       Tcl  regular  expressions  are implemented using the package written by
       Henry Spencer, based on the 1003.2 spec and some (not quite all) of the
       Perl5  extensions (thanks, Henry!).  Much of the description of regular
       expressions below is copied verbatim from his manual entry.

       An ARE is one or more 4mbranches24m, separated  by  `1m|22m',  matching  anything
       that matches any of the branches.

       A branch is zero or more 4mconstraints24m or 4mquantified24m 4matoms24m, concatenated.
       It matches a match for the first, followed by a match for  the  second,
       etc; an empty branch matches the empty string.

       A  quantified atom is an 4matom24m possibly followed by a single 4mquantifier24m.
       Without a quantifier, it matches a match for  the  atom.   The  quanti-
       fiers, and what a so-quantified atom matches, are:

         1m*     22ma sequence of 0 or more matches of the atom

         1m+     22ma sequence of 1 or more matches of the atom

         1m?     22ma sequence of 0 or 1 matches of the atom

         1m{4m22mm24m1m}   22ma sequence of exactly 4mm24m matches of the atom

         1m{4m22mm24m1m,}  22ma sequence of 4mm24m or more matches of the atom

         1m{4m22mm24m1m,4m22mn24m1m} 22ma  sequence  of  4mm24m through 4mn24m (inclusive) matches of the atom; 4mm0m
               may not exceed 4mn0m

         1m*?  +?  ??  {4m22mm24m1m}?  {4m22mm24m1m,}?  {4m22mm24m1m,4m22mn24m1m}?0m
               4mnon-greedy24m quantifiers, which match the same possibilities, but
               prefer  the  smallest  number rather than the largest number of
               matches (see MATCHING)

       The forms using 1m{ 22mand 1m} 22mare known as 4mbound24ms.  The numbers 4mm24m and  4mn24m  are
       unsigned  decimal integers with permissible values from 0 to 255 inclu-
       sive.

       An atom is one of:

         1m(4m22mre24m1m)  22m(where 4mre24m is any regular expression) matches a  match  for  4mre24m,
               with the match noted for possible reporting

         1m(?:4m22mre24m1m)0m
               as  previous, but does no reporting (a ``non-capturing'' set of
               parentheses)

         1m()    22mmatches an empty string, noted for possible reporting

         1m(?:)  22mmatches an empty string, without reporting

         1m[4m22mchars24m1m]0m
               a 4mbracket24m 4mexpression24m,  matching  any  one  of  the  4mchars24m  (see
               BRACKET EXPRESSIONS for more detail)

          1m.    22mmatches any single character

         1m\4m22mk24m    (where  4mk24m is a non-alphanumeric character) matches that charac-
               ter taken as an ordinary character, e.g. \\ matches a backslash
               character

         1m\4m22mc24m    where  4mc24m  is  alphanumeric  (possibly followed by other charac-
               ters), an 4mescape24m (AREs only), see ESCAPES below

         1m{     22mwhen followed by a character other than a  digit,  matches  the
               left-brace  character  `1m{22m'; when followed by a digit, it is the
               beginning of a 4mbound24m (see above)

         4mx24m     where 4mx24m is a  single  character  with  no  other  significance,
               matches that character.

       A  4mconstraint24m matches an empty string when specific conditions are met.
       A constraint may not be followed by  a  quantifier.   The  simple  con-
       straints  are  as  follows;  some more constraints are described later,
       under ESCAPES.

         1m^       22mmatches at the beginning of a line

         1m$       22mmatches at the end of a line

         1m(?=4m22mre24m1m)  4m22mpositive24m 4mlookahead24m (AREs only), matches at any point where  a
                 substring matching 4mre24m begins

         1m(?!4m22mre24m1m)  4m22mnegative24m 4mlookahead24m (AREs only), matches at any point where no
                 substring matching 4mre24m begins

       The lookahead constraints may not contain back references (see  later),
       and all parentheses within them are considered non-capturing.

       An RE may not end with `1m\22m'.


1mBRACKET EXPRESSIONS0m
       A 4mbracket24m 4mexpression24m is a list of characters enclosed in `1m[]22m'.  It nor-
       mally matches any single character from the list (but see  below).   If
       the  list  begins  with  `1m^22m',  it matches any single character (but see
       below) 4mnot24m from the rest of the list.

       If two characters in the list are separated by `1m-22m', this  is  shorthand
       for  the  full 4mrange24m of characters between those two (inclusive) in the
       collating sequence, e.g.  1m[0-9] 22min ASCII  matches  any  decimal  digit.
       Two  ranges  may  not  share  an  endpoint,  so e.g.  1ma-c-e 22mis illegal.
       Ranges are very  collating-sequence-dependent,  and  portable  programs
       should avoid relying on them.

       To  include  a  literal  1m]  22mor 1m- 22min the list, the simplest method is to
       enclose it in 1m[. 22mand 1m.]  22mto make it a collating  element  (see  below).
       Alternatively,  make it the first character (following a possible `1m^22m'),
       or (AREs only) precede it with `1m\22m'.  Alternatively, for  `1m-22m',  make  it
       the  last  character, or the second endpoint of a range.  To use a lit-
       eral 1m- 22mas the first endpoint of a range, make it a collating element or
       (AREs  only)  precede  it  with `1m\22m'.  With the exception of these, some
       combinations using 1m[ 22m(see next paragraphs), and escapes, all other spe-
       cial  characters  lose  their  special  significance  within  a bracket
       expression.

       Within a bracket expression, a collating element (a character, a multi-
       character sequence that collates as if it were a single character, or a
       collating-sequence name for either) enclosed in 1m[. 22mand 1m.]   22mstands  for
       the  sequence of characters of that collating element.  The sequence is
       a single element of the bracket expression's list.  A  bracket  expres-
       sion  in  a locale that has multi-character collating elements can thus
       match more than one character.  So (insidiously), a bracket  expression
       that starts with 1m^ 22mcan match multi-character collating elements even if
       none of them appear in the bracket expression!   (4mNote:24m  Tcl  currently
       has  no  multi-character  collating elements.  This information is only
       for illustration.)

       For example, assume the collating sequence includes a 1mch  22mmulti-charac-
       ter  collating element.  Then the RE 1m[[.ch.]]*c 22m(zero or more 1mch22m's fol-
       lowed by 1mc22m) matches the first five characters of `1mchchcc22m'.   Also,  the
       RE 1m[^c]b 22mmatches all of `1mchb22m' (because 1m[^c] 22mmatches the multi-character
       1mch22m).

       Within a bracket expression, a collating element enclosed in 1m[= 22mand  1m=]0m
       is  an  equivalence  class, standing for the sequences of characters of
       all collating elements equivalent to that one, including  itself.   (If
       there  are  no other equivalent collating elements, the treatment is as
       if the enclosing delimiters were `1m[.22m' and `1m.]22m'.)  For example, if 1mo 22mand
       1m^  22mare  the members of an equivalence class, then `1m[[=o=]]22m', `1m[[=^=]]22m',
       and `1m[o^]22m' are all synonymous.  An equivalence class may not be an end-
       point  of  a  range.   (4mNote:24m Tcl currently implements only the Unicode
       locale.  It doesn't define any equivalence classes.  The examples above
       are just illustrations.)

       Within  a bracket expression, the name of a 4mcharacter24m 4mclass24m enclosed in
       1m[: 22mand 1m:] 22mstands for the list of all characters (not all collating ele-
       ments!)  belonging to that class.  Standard character classes are:

              1malpha       22mA letter.
              1mupper       22mAn upper-case letter.
              1mlower       22mA lower-case letter.
              1mdigit       22mA decimal digit.
              1mxdigit      22mA hexadecimal digit.
              1malnum       22mAn alphanumeric (letter or digit).
              1mprint       22mAn alphanumeric (same as alnum).
              1mblank       22mA space or tab character.
              1mspace       22mA character producing white space in displayed text.
              1mpunct       22mA punctuation character.
              1mgraph       22mA character with a visible representation.
              1mcntrl       22mA control character.

       A locale may provide others.  (Note that the current Tcl implementation
       has only one locale: the Unicode locale.)  A character class may not be
       used as an endpoint of a range.

       There are two special cases of bracket expressions: the bracket expres-
       sions 1m[[:<:]] 22mand 1m[[:>:]] 22mare constraints, matching  empty  strings  at
       the  beginning  and end of a word respectively.  A word is defined as a
       sequence of word characters that is neither preceded  nor  followed  by
       word  characters.   A word character is an 4malnum24m character or an under-
       score (1m_22m).  These special bracket expressions are deprecated; users  of
       AREs should use constraint escapes instead (see below).

1mESCAPES0m
       Escapes  (AREs  only), which begin with a 1m\ 22mfollowed by an alphanumeric
       character, come in several varieties:  character  entry,  class  short-
       hands,  constraint  escapes,  and  back references.  A 1m\ 22mfollowed by an
       alphanumeric character but not constituting a valid escape  is  illegal
       in  AREs.  In EREs, there are no escapes: outside a bracket expression,
       a 1m\ 22mfollowed by an alphanumeric character merely stands for that  char-
       acter  as  an ordinary character, and inside a bracket expression, 1m\ 22mis
       an ordinary character.  (The latter is the one  actual  incompatibility
       between EREs and AREs.)

       Character-entry  escapes (AREs only) exist to make it easier to specify
       non-printing and otherwise inconvenient characters in REs:

         1m\a   22malert (bell) character, as in C

         1m\b   22mbackspace, as in C

         1m\B   22msynonym for 1m\ 22mto help reduce backslash doubling in some applica-
              tions where there are multiple levels of backslash processing

         1m\c4m22mX24m  (where  X is any character) the character whose low-order 5 bits
              are the same as those of 4mX24m, and whose other bits are all zero

         1m\e   22mthe character whose collating-sequence name is `1mESC22m', or failing
              that, the character with octal value 033

         1m\f   22mformfeed, as in C

         1m\n   22mnewline, as in C

         1m\r   22mcarriage return, as in C

         1m\t   22mhorizontal tab, as in C

         1m\u4m22mwxyz0m
              (where  4mwxyz24m  is  exactly  four  hexadecimal digits) the Unicode
              character 1mU+4m22mwxyz24m in the local byte ordering

         1m\U4m22mstuvwxyz0m
              (where 4mstuvwxyz24m is exactly eight  hexadecimal  digits)  reserved
              for a somewhat-hypothetical Unicode extension to 32 bits

         1m\v   22mvertical tab, as in C are all available.

         1m\x4m22mhhh0m
              (where  4mhhh24m is any sequence of hexadecimal digits) the character
              whose hexadecimal value is 1m0x4m22mhhh24m (a single character  no  matter
              how many hexadecimal digits are used).

         1m\0   22mthe character whose value is 1m00m

         1m\4m22mxy24m  (where  4mxy24m is exactly two octal digits, and is not a 4mback24m 4mrefer-0m
              4mence24m (see below)) the character whose octal value is 1m04m22mxy0m

         1m\4m22mxyz24m (where 4mxyz24m is exactly three octal digits, and is not a back ref-
              erence (see below)) the character whose octal value is 1m04m22mxyz0m

       Hexadecimal digits are `1m022m'-`1m922m', `1ma22m'-`1mf22m', and `1mA22m'-`1mF22m'.  Octal digits are
       `1m022m'-`1m722m'.

       The character-entry escapes are always taken  as  ordinary  characters.
       For  example, 1m\135 22mis 1m] 22min ASCII, but 1m\135 22mdoes not terminate a bracket
       expression.  Beware, however, that some applications (e.g.,  C  compil-
       ers)  interpret such sequences themselves before the regular-expression
       package gets to see them,  which  may  require  doubling  (quadrupling,
       etc.) the `1m\22m'.

       Class-shorthand escapes (AREs only) provide shorthands for certain com-
       monly-used character classes:

         1m\d        [[:digit:]]0m

         1m\s        [[:space:]]0m

         1m\w        [[:alnum:]_] 22m(note underscore)

         1m\D        [^[:digit:]]0m

         1m\S        [^[:space:]]0m

         1m\W        [^[:alnum:]_] 22m(note underscore)

       Within bracket expressions, `1m\d22m',  `1m\s22m',  and  `1m\w22m'  lose  their  outer
       brackets,  and `1m\D22m', `1m\S22m', and `1m\W22m' are illegal.  (So, for example, 1m[a-0m
       1mc\d] 22mis equivalent to 1m[a-c[:digit:]]22m.  Also, 1m[a-c\D]22m, which is  equiva-
       lent to 1m[a-c^[:digit:]]22m, is illegal.)

       A  constraint  escape  (AREs  only) is a constraint, matching the empty
       string if specific conditions are met, written as an escape:

         1m\A    22mmatches only at the beginning  of  the  string  (see  MATCHING,
               below, for how this differs from `1m^22m')

         1m\m    22mmatches only at the beginning of a word

         1m\M    22mmatches only at the end of a word

         1m\y    22mmatches only at the beginning or end of a word

         1m\Y    22mmatches  only  at a point that is not the beginning or end of a
               word

         1m\Z    22mmatches only at the end of the string (see MATCHING, below, for
               how this differs from `1m$22m')

         1m\4m22mm24m    (where 4mm24m is a nonzero digit) a 4mback24m 4mreference24m, see below

         1m\4m22mmnn24m  (where  4mm24m  is  a nonzero digit, and 4mnn24m is some more digits, and
               the decimal value 4mmnn24m is not greater than the number of closing
               capturing parentheses seen so far) a 4mback24m 4mreference24m, see below

       A word is defined as in the specification of 1m[[:<:]] 22mand 1m[[:>:]] 22mabove.
       Constraint escapes are illegal within bracket expressions.

       A back reference (AREs only) matches the same  string  matched  by  the
       parenthesized  subexpression  specified  by  the number, so that (e.g.)
       1m([bc])\1 22mmatches 1mbb  22mor  1mcc  22mbut  not  `1mbc22m'.   The  subexpression  must
       entirely precede the back reference in the RE.  Subexpressions are num-
       bered in the order of their leading parentheses.  Non-capturing  paren-
       theses do not define subexpressions.

       There is an inherent historical ambiguity between octal character-entry
       escapes and back references, which is resolved by heuristics, as hinted
       at  above.   A leading zero always indicates an octal escape.  A single
       non-zero digit, not followed by another digit, is  always  taken  as  a
       back  reference.   A  multi-digit  sequence not starting with a zero is
       taken as a back reference if it comes after  a  suitable  subexpression
       (i.e.  the number is in the legal range for a back reference), and oth-
       erwise is taken as octal.

1mMETASYNTAX0m
       In addition to the main syntax described above, there are some  special
       forms and miscellaneous syntactic facilities available.

       Normally the flavor of RE being used is specified by application-depen-
       dent means.  However, this can be overridden by a 4mdirector24m.  If  an  RE
       of  any flavor begins with `1m***:22m', the rest of the RE is an ARE.  If an
       RE of any flavor begins with `1m***=22m', the rest of the RE is taken to  be
       a literal string, with all characters considered ordinary characters.

       An ARE may begin with 4membedded24m 4moptions24m: a sequence 1m(?4m22mxyz24m1m) 22m(where 4mxyz24m is
       one or more alphabetic characters) specifies options affecting the rest
       of  the  RE.  These supplement, and can override, any options specified
       by the application.  The available option letters are:

         1mb  22mrest of RE is a BRE

         1mc  22mcase-sensitive matching (usual default)

         1me  22mrest of RE is an ERE

         1mi  22mcase-insensitive matching (see MATCHING, below)

         1mm  22mhistorical synonym for 1mn0m

         1mn  22mnewline-sensitive matching (see MATCHING, below)

         1mp  22mpartial newline-sensitive matching (see MATCHING, below)

         1mq  22mrest of RE is a literal (``quoted'') string, all ordinary  charac-
            ters

         1ms  22mnon-newline-sensitive matching (usual default)

         1mt  22mtight syntax (usual default; see below)

         1mw  22minverse partial newline-sensitive (``weird'') matching (see MATCH-
            ING, below)

         1mx  22mexpanded syntax (see below)

       Embedded options take effect at the 1m) 22mterminating the  sequence.   They
       are  available  only  at the start of an ARE, and may not be used later
       within it.

       In addition to the usual (4mtight24m) RE syntax, in which all characters are
       significant,  there  is an 4mexpanded24m syntax, available in all flavors of
       RE with the 1m-expanded 22mswitch, or in AREs with the  embedded  x  option.
       In  the  expanded  syntax,  white-space  characters are ignored and all
       characters between a 1m# 22mand the following newline (or the end of the RE)
       are  ignored,  permitting  paragraphing  and  commenting  a complex RE.
       There are three exceptions to that basic rule:

         a white-space character or `1m#22m' preceded by `1m\22m' is retained

         white space or `1m#22m' within a bracket expression is retained

         white space and comments are illegal within  multi-character  symbols
         like the ARE `1m(?:22m' or the BRE `1m\(22m'

       Expanded-syntax white-space characters are blank, tab, newline, and any
       character that belongs to the 4mspace24m character class.

       Finally, in an ARE, outside bracket expressions, the sequence `1m(?#4m22mttt24m1m)22m'
       (where  4mttt24m  is any text not containing a `1m)22m') is a comment, completely
       ignored.  Again, this is not allowed between the characters  of  multi-
       character  symbols  like  `1m(?:22m'.   Such  comments are more a historical
       artifact than a useful facility, and their use is deprecated;  use  the
       expanded syntax instead.

       4mNone24m of these metasyntax extensions is available if the application (or
       an initial 1m***= 22mdirector)  has  specified  that  the  user's  input  be
       treated as a literal string rather than as an RE.

1mMATCHING0m
       In  the event that an RE could match more than one substring of a given
       string, the RE matches the one starting earliest in the string.  If the
       RE  could  match  more  than  one substring starting at that point, its
       choice is determined by its 4mpreference24m: either the  longest  substring,
       or the shortest.

       Most  atoms,  and all constraints, have no preference.  A parenthesized
       RE has the same preference (possibly none) as  the  RE.   A  quantified
       atom  with  quantifier  1m{4m22mm24m1m}  22mor 1m{4m22mm24m1m}?  22mhas the same preference (possibly
       none) as the atom itself.  A quantified atom with other normal  quanti-
       fiers  (including  1m{4m22mm24m1m,4m22mn24m1m}  22mwith  4mm24m equal to 4mn24m) prefers longest match.  A
       quantified atom with other  non-greedy  quantifiers  (including  1m{4m22mm24m1m,4m22mn24m1m}?0m
       with 4mm24m equal to 4mn24m) prefers shortest match.  A branch has the same pref-
       erence as the first quantified atom in it which has a  preference.   An
       RE  consisting  of  two  or  more  branches connected by the 1m| 22moperator
       prefers longest match.

       Subject to the constraints imposed by the rules for matching the  whole
       RE,  subexpressions  also  match  the longest or shortest possible sub-
       strings, based on their preferences, with subexpressions starting  ear-
       lier  in  the  RE  taking priority over ones starting later.  Note that
       outer subexpressions thus take priority over their component subexpres-
       sions.

       Note  that the quantifiers 1m{1,1} 22mand 1m{1,1}?  22mcan be used to force long-
       est and shortest preference, respectively,  on  a  subexpression  or  a
       whole RE.

       Match  lengths  are measured in characters, not collating elements.  An
       empty string is considered longer than no match at all.   For  example,
       1mbb*    22mmatches    the    three    middle    characters    of   `1mabbbc22m',
       1m(week|wee)(night|knights) 22mmatches all ten characters  of  `1mweeknights22m',
       when  1m(.*).*   22mis  matched  against 1mabc 22mthe parenthesized subexpression
       matches all three characters, and when 1m(a*)* 22mis matched against 1mbc 22mboth
       the whole RE and the parenthesized subexpression match an empty string.

       If case-independent matching is specified, the effect is much as if all
       case  distinctions  had vanished from the alphabet.  When an alphabetic
       that exists in multiple cases appears as an ordinary character  outside
       a  bracket  expression,  it  is  effectively transformed into a bracket
       expression containing both cases, so that 1mx 22mbecomes  `1m[xX]22m'.   When  it
       appears  inside  a  bracket expression, all case counterparts of it are
       added to the bracket expression, so that  1m[x]  22mbecomes  1m[xX]  22mand  1m[^x]0m
       becomes `1m[^xX]22m'.

       If  newline-sensitive matching is specified, 1m.  22mand bracket expressions
       using 1m^ 22mwill never match the newline character (so  that  matches  will
       never  cross newlines unless the RE explicitly arranges it) and 1m^ 22mand 1m$0m
       will match the empty string after and before a newline respectively, in
       addition  to matching at beginning and end of string respectively.  ARE
       1m\A 22mand 1m\Z 22mcontinue to match beginning or end of string 4monly24m.

       If partial newline-sensitive matching is specified, this affects 1m.  22mand
       bracket  expressions  as with newline-sensitive matching, but not 1m^ 22mand
       `1m$22m'.

       If  inverse  partial  newline-sensitive  matching  is  specified,  this
       affects  1m^  22mand  1m$  22mas  with newline-sensitive matching, but not 1m.  22mand
       bracket expressions.  This isn't very useful but is provided for symme-
       try.

1mLIMITS AND COMPATIBILITY0m
       No particular limit is imposed on the length of REs.  Programs intended
       to be highly portable should not employ REs longer than 256 bytes, as a
       POSIX-compliant implementation can refuse to accept such REs.

       The  only feature of AREs that is actually incompatible with POSIX EREs
       is that 1m\ 22mdoes not lose its special significance inside bracket expres-
       sions.  All other ARE features use syntax which is illegal or has unde-
       fined or unspecified effects in POSIX EREs; the 1m*** 22msyntax of directors
       likewise is outside the POSIX syntax for both BREs and EREs.

       Many  of  the ARE extensions are borrowed from Perl, but some have been
       changed to clean them up, and a few Perl extensions  are  not  present.
       Incompatibilities  of  note  include  `1m\b22m',  `1m\B22m',  the lack of special
       treatment for a trailing newline, the addition of complemented  bracket
       expressions  to  the things affected by newline-sensitive matching, the
       restrictions on parentheses  and  back  references  in  lookahead  con-
       straints,  and  the  longest/shortest-match  (rather  than first-match)
       matching semantics.

       The matching rules for REs containing both normal and non-greedy  quan-
       tifiers  have  changed  since early beta-test versions of this package.
       (The new rules are much simpler and cleaner, but don't work as hard  at
       guessing the user's real intentions.)

       Henry  Spencer's  original 1986 4mregexp24m package, still in widespread use
       (e.g., in pre-8.1 releases of Tcl), implemented  an  early  version  of
       today's  EREs.  There are four incompatibilities between 4mregexp24m's near-
       EREs (`RREs' for short) and AREs.  In roughly increasing order of  sig-
       nificance:

              In  AREs,  1m\  22mfollowed by an alphanumeric character is either an
              escape or an error, while in RREs, it was just  another  way  of
              writing  the alphanumeric.  This should not be a problem because
              there was no reason to write such a sequence in RREs.

              1m{ 22mfollowed by a digit in an ARE is the  beginning  of  a  bound,
              while  in  RREs,  1m{  22mwas  always  an  ordinary  character.  Such
              sequences should be rare, and will  often  result  in  an  error
              because following characters will not look like a valid bound.

              In AREs, 1m\ 22mremains a special character within `1m[]22m', so a literal
              1m\ 22mwithin 1m[] 22mmust be written `1m\\22m'.  1m\\ 22malso  gives  a  literal  1m\0m
              within 1m[] 22min RREs, but only truly paranoid programmers routinely
              doubled the backslash.

              AREs report the longest/shortest match for the RE,  rather  than
              the  first  found  in a specified search order.  This may affect
              some RREs which were written in the expectation that  the  first
              match would be reported.  (The careful crafting of RREs to opti-
              mize the search order for fast matching is obsolete (AREs  exam-
              ine  all  possible matches in parallel, and their performance is
              largely insensitive to their complexity)  but  cases  where  the
              search  order  was  exploited to deliberately find a match which
              was 4mnot24m the longest/shortest will need rewriting.)


1mBASIC REGULAR EXPRESSIONS0m
       BREs differ from EREs in several respects.  `1m|22m', `1m+22m', and 1m?  22mare  ordi-
       nary  characters  and  there  is no equivalent for their functionality.
       The delimiters for bounds are 1m\{ 22mand `1m\}22m', with 1m{ 22mand 1m}  22mby  themselves
       ordinary  characters.  The parentheses for nested subexpressions are 1m\(0m
       and `1m\)22m', with 1m( 22mand 1m) 22mby themselves  ordinary  characters.   1m^  22mis  an
       ordinary  character  except at the beginning of the RE or the beginning
       of a parenthesized subexpression, 1m$ 22mis an ordinary character except  at
       the end of the RE or the end of a parenthesized subexpression, and 1m* 22mis
       an ordinary character if it appears at the beginning of the RE  or  the
       beginning  of  a  parenthesized subexpression (after a possible leading
       `1m^22m').  Finally, single-digit back references are available, and 1m\<  22mand
       1m\>  22mare synonyms for 1m[[:<:]] 22mand 1m[[:>:]] 22mrespectively; no other escapes
       are available.


1mSEE ALSO0m
       RegExp(3), regexp(n), regsub(n), lsearch(n), switch(n), text(n)


1mKEYWORDS0m
