Fix crash when auto-sizing a wxDataViewCtrl column.
[wxWidgets.git] / tests / regex / reg.test
1 # reg.test --
2 #
3 # This file contains a collection of tests for one or more of the Tcl
4 # built-in commands.  Sourcing this file into Tcl runs the tests and
5 # generates output for errors.  No output means no errors were found.
6 # (Don't panic if you are seeing this as part of the reg distribution
7 # and aren't using Tcl -- reg's own regression tester also knows how
8 # to read this file, ignoring the Tcl-isms.)
9 #
10 # Copyright (c) 1998, 1999 Henry Spencer.  All rights reserved.
11 #
12
13 if {[lsearch [namespace children] ::tcltest] == -1} {
14     package require tcltest 2
15     namespace import -force ::tcltest::*
16 }
17
18 # All tests require the testregexp command, return if this
19 # command doesn't exist
20
21 ::tcltest::testConstraint testregexp \
22         [expr {[info commands testregexp] != {}}]
23 ::tcltest::testConstraint localeRegexp 0
24
25 # This file uses some custom procedures, defined below, for regexp regression
26 # testing.  The name of the procedure indicates the general nature of the
27 # test:
28 #       e       compile error expected
29 #       f       match failure expected
30 #       m       successful match
31 #       i       successful match with -indices (used in checking things like
32 #               nonparticipating subexpressions)
33 #       p       unsuccessful match with -indices (!!) (used in checking
34 #               partial-match reporting)
35 # There is also "doing" which sets up title and major test number for each
36 # block of tests.
37
38 # The first 3 arguments are constant:  a minor number (which often gets
39 # a letter or two suffixed to it internally), some flags, and the RE itself.
40 # For e, the remaining argument is the name of the compile error expected,
41 # less the leading "REG_".  For the rest, the next argument is the string
42 # to try the match against.  Remaining arguments are the substring expected
43 # to be matched, and any substrings expected to be matched by subexpressions.
44 # (For f, these arguments are optional, and if present are ignored except
45 # that they indicate how many subexpressions should be present in the RE.)
46 # It is an error for the number of subexpression arguments to be wrong.
47 # Cases involving nonparticipating subexpressions, checking where empty
48 # substrings are located, etc. should be done using i and p.
49
50 # The flag characters are complex and a bit eclectic.  Generally speaking, 
51 # lowercase letters are compile options, uppercase are expected re_info
52 # bits, and nonalphabetics are match options, controls for how the test is 
53 # run, or testing options.  The one small surprise is that AREs are the
54 # default, and you must explicitly request lesser flavors of RE.  The flags
55 # are as follows.  It is admitted that some are not very mnemonic.
56 # There are some others which are purely debugging tools and are not
57 # useful in this file.
58 #
59 #       -       no-op (placeholder)
60 #       +       provide fake xy equivalence class and ch collating element
61 #       %       force small state-set cache in matcher (to test cache replace)
62 #       ^       beginning of string is not beginning of line
63 #       $       end of string is not end of line
64 #       *       test is Unicode-specific, needs big character set
65 #
66 #       &       test as both ARE and BRE
67 #       b       BRE
68 #       e       ERE
69 #       a       turn advanced-features bit on (error unless ERE already)
70 #       q       literal string, no metacharacters at all
71 #
72 #       i       case-independent matching
73 #       o       ("opaque") no subexpression capture
74 #       p       newlines are half-magic, excluded from . and [^ only
75 #       w       newlines are half-magic, significant to ^ and $ only
76 #       n       newlines are fully magic, both effects
77 #       x       expanded RE syntax
78 #       t       incomplete-match reporting
79 #
80 #       A       backslash-_a_lphanumeric seen
81 #       B       ERE/ARE literal-_b_race heuristic used
82 #       E       backslash (_e_scape) seen within []
83 #       H       looka_h_ead constraint seen
84 #       I       _i_mpossible to match
85 #       L       _l_ocale-specific construct seen
86 #       M       unportable (_m_achine-specific) construct seen
87 #       N       RE can match empty (_n_ull) string
88 #       P       non-_P_OSIX construct seen
89 #       Q       {} _q_uantifier seen
90 #       R       back _r_eference seen
91 #       S       POSIX-un_s_pecified syntax seen
92 #       T       prefers shortest (_t_iny)
93 #       U       saw original-POSIX botch:  unmatched right paren in ERE (_u_gh)
94
95 # The one area we can't easily test is memory-allocation failures (which
96 # are hard to provoke on command).  Embedded NULs also are not tested at
97 # the moment, but this is a historical accident which should be fixed.
98
99
100
101 # test procedures and related
102
103 set ask "about"
104 set xflags "xflags"
105 set testbypassed 0
106
107 # re_info abbreviation mapping table
108 set infonames(A) "REG_UBSALNUM"
109 set infonames(B) "REG_UBRACES"
110 set infonames(E) "REG_UBBS"
111 set infonames(H) "REG_ULOOKAHEAD"
112 set infonames(I) "REG_UIMPOSSIBLE"
113 set infonames(L) "REG_ULOCALE"
114 set infonames(M) "REG_UUNPORT"
115 set infonames(N) "REG_UEMPTYMATCH"
116 set infonames(P) "REG_UNONPOSIX"
117 set infonames(Q) "REG_UBOUNDS"
118 set infonames(R) "REG_UBACKREF"
119 set infonames(S) "REG_UUNSPEC"
120 set infonames(T) "REG_USHORTEST"
121 set infonames(U) "REG_UPBOTCH"
122 set infonameorder "RHQBAUEPSMLNIT"      ;# must match bit order, lsb first
123
124 # set major test number and description
125 proc doing {major desc} {
126         global prefix description testbypassed
127
128         if {$testbypassed != 0} {
129                 puts stdout "!!! bypassed $testbypassed tests in\
130                                          $prefix, `$description'"
131         }
132
133         set prefix reg-$major
134         set description "reg $desc"
135         set testbypassed 0
136 }
137
138 # build test number (internal)
139 proc tno {testid} {
140         return [join $testid .]
141 }
142
143 # build description, with possible modifiers (internal)
144 proc desc {testid} {
145         global description
146
147         set d $description
148         if {[llength $testid] > 1} {
149                 set d "([lreplace $testid 0 0]) $d"
150         }
151         return $d
152 }
153
154 # build trailing options and flags argument from a flags string (internal)
155 proc flags {fl} {
156         global xflags
157
158         set args [list]
159         set flags ""
160         foreach f [split $fl ""] {
161                 switch -exact -- $f {
162                 "i" { lappend args "-nocase" }
163                 "x" { lappend args "-expanded" }
164                 "n" { lappend args "-line" }
165                 "p" { lappend args "-linestop" }
166                 "w" { lappend args "-lineanchor" }
167                 "-" { }
168                 default { append flags $f }
169                 }
170         }
171         if {[string compare $flags ""] != 0} {
172                 lappend args -$xflags $flags
173         }
174         return $args
175 }
176
177 # build info-flags list from a flags string (internal)
178 proc infoflags {fl} {
179         global infonames infonameorder
180
181         set ret [list]
182         foreach f [split $infonameorder ""] {
183                 if {[string first $f $fl] >= 0} {
184                         lappend ret $infonames($f)
185                 }
186         }
187         return $ret
188 }
189
190 # compilation error expected
191 proc e {testid flags re err} {
192         global prefix ask errorCode
193
194         # Tcl locale stuff doesn't do the ch/xy test fakery yet
195         if {[string first "+" $flags] >= 0} {
196             # This will register as a skipped test
197             test $prefix.[tno $testid] [desc $testid] localeRegexp {} {}
198             return
199         }
200
201         # if &, test as both ARE and BRE
202         set amp [string first "&" $flags]
203         if {$amp >= 0} {
204                 set f [string range $flags 0 [expr $amp - 1]]
205                 append f [string range $flags [expr $amp + 1] end]
206                 e [linsert $testid end ARE] ${f} $re $err
207                 e [linsert $testid end BRE] ${f}b $re $err
208                 return
209         }
210
211         set cmd [concat [list testregexp -$ask] [flags $flags] [list $re]]
212         set run "list \[catch \{$cmd\}\] \[lindex \$errorCode 1\]"
213         test $prefix.[tno $testid] [desc $testid] \
214                 {testregexp} $run [list 1 REG_$err]
215 }
216
217 # match failure expected
218 proc f {testid flags re target args} {
219         global prefix description ask
220
221         # Tcl locale stuff doesn't do the ch/xy test fakery yet
222         if {[string first "+" $flags] >= 0} {
223             # This will register as a skipped test
224             test $prefix.[tno $testid] [desc $testid] localeRegexp {} {}
225             return
226         }
227
228         # if &, test as both ARE and BRE
229         set amp [string first "&" $flags]
230         if {$amp >= 0} {
231                 set f [string range $flags 0 [expr $amp - 1]]
232                 append f [string range $flags [expr $amp + 1] end]
233                 eval [linsert $args 0 f [linsert $testid end ARE] ${f} $re \
234                                                                 $target]
235                 eval [linsert $args 0 f [linsert $testid end BRE] ${f}b $re \
236                                                                 $target]
237                 return
238         }
239
240         set f [flags $flags]
241         set infoflags [infoflags $flags]
242         set ccmd [concat [list testregexp -$ask] $f [list $re]]
243         set nsub [expr [llength $args] - 1]
244         if {$nsub == -1} {
245                 # didn't tell us number of subexps
246                 set ccmd "lreplace \[$ccmd\] 0 0"
247                 set info [list $infoflags]
248         } else {
249                 set info [list $nsub $infoflags]
250         }
251         lappend testid "compile"
252         test $prefix.[tno $testid] [desc $testid] {testregexp} $ccmd $info
253
254         set testid [lreplace $testid end end "execute"]
255         set ecmd [concat [list testregexp] $f [list $re $target]]
256         test $prefix.[tno $testid] [desc $testid] {testregexp} $ecmd 0
257 }
258
259 # match expected, internal routine that does the work
260 # parameters like the "real" routines except they don't have "opts",
261 #  which is a possibly-empty list of switches for the regexp match attempt
262 # The ! flag is used to indicate expected match failure (for REG_EXPECT,
263 #  which wants argument testing even in the event of failure).
264 proc matchexpected {opts testid flags re target args} {
265         global prefix description ask regBug
266
267     if {[info exists regBug] && $regBug} {
268         # This will register as a skipped test
269         test $prefix.[tno $testid] [desc $testid] knownBug {format 0} {1}
270         return
271     }
272
273         # Tcl locale stuff doesn't do the ch/xy test fakery yet
274         if {[string first "+" $flags] >= 0} {
275             # This will register as a skipped test
276             test $prefix.[tno $testid] [desc $testid] localeRegexp {} {}
277             return
278         }
279
280         # if &, test as both BRE and ARE
281         set amp [string first "&" $flags]
282         if {$amp >= 0} {
283                 set f [string range $flags 0 [expr $amp - 1]]
284                 append f [string range $flags [expr $amp + 1] end]
285                 eval [concat [list matchexpected $opts \
286                         [linsert $testid end ARE] ${f} $re $target] $args]
287                 eval [concat [list matchexpected $opts \
288                         [linsert $testid end BRE] ${f}b $re $target] $args]
289                 return
290         }
291
292         set f [flags $flags]
293         set infoflags [infoflags $flags]
294         set ccmd [concat [list testregexp -$ask] $f [list $re]]
295         set ecmd [concat [list testregexp] $opts $f [list $re $target]]
296
297         set nsub [expr [llength $args] - 1]
298         set names [list]
299         set refs ""
300         for {set i 0} {$i <= $nsub} {incr i} {
301                 if {$i == 0} {
302                         set name match
303                 } else {
304                         set name sub$i
305                 }
306                 lappend names $name
307                 append refs " \$$name"
308                 set $name ""
309         }
310         if {[string first "o" $flags] >= 0} {   ;# REG_NOSUB kludge
311                 set nsub 0              ;# unsigned value cannot be -1
312         }
313         if {[string first "t" $flags] >= 0} {   ;# REG_EXPECT
314                 incr nsub -1            ;# the extra does not count
315         }
316         set ecmd [concat $ecmd $names]
317         set erun "list \[$ecmd\] $refs"
318         set retcode [list 1]
319         if {[string first "!" $flags] >= 0} {
320                 set retcode [list 0]
321         }
322         set result [concat $retcode $args]
323
324         set info [list $nsub $infoflags]
325         lappend testid "compile"
326         test $prefix.[tno $testid] [desc $testid] {testregexp} $ccmd $info
327         set testid [lreplace $testid end end "execute"]
328         test $prefix.[tno $testid] [desc $testid] {testregexp} $erun $result
329 }
330
331 # match expected (no missing, empty, or ambiguous submatches)
332 # m testno flags re target mat submat ...
333 proc m {args} {
334         eval matchexpected [linsert $args 0 [list]]
335 }
336
337 # match expected (full fanciness)
338 # i testno flags re target mat submat ...
339 proc i {args} {
340         eval matchexpected [linsert $args 0 [list "-indices"]]
341 }
342
343 # partial match expected
344 # p testno flags re target mat "" ...
345 # Quirk:  number of ""s must be one more than number of subREs.
346 proc p {args} {
347         set f [lindex $args 1]                  ;# add ! flag
348         set args [lreplace $args 1 1 "!$f"]
349         eval matchexpected [linsert $args 0 [list "-indices"]]
350 }
351
352 # test is a knownBug
353 proc knownBug {args} {
354     set ::regBug 1
355     uplevel #0 $args
356     set ::regBug 0
357 }
358
359
360
361 # the tests themselves
362
363
364
365 # support functions and preliminary misc.
366 # This is sensitive to changes in message wording, but we really have to
367 # test the code->message expansion at least once.
368 test reg-0.1 "regexp error reporting" {
369         list [catch {regexp (*) ign} msg] $msg
370 } {1 {couldn't compile regular expression pattern: quantifier operand invalid}}
371
372
373
374 doing 1 "basic sanity checks"
375 m  1    &       abc             abc     abc
376 f  2    &       abc             def
377 m  3    &       abc             xyabxabce       abc
378
379
380
381 doing 2 "invalid option combinations"
382 e  1    qe      a               INVARG
383 e  2    qa      a               INVARG
384 e  3    qx      a               INVARG
385 e  4    qn      a               INVARG
386 e  5    ba      a               INVARG
387
388
389
390 doing 3 "basic syntax"
391 i  1    &NS     ""              a       {0 -1}
392 m  2    NS      a|              a       a
393 m  3    -       a|b             a       a
394 m  4    -       a|b             b       b
395 m  5    NS      a||b            b       b
396 m  6    &       ab              ab      ab
397
398
399
400 doing 4 "parentheses"
401 m  1    -       (a)e            ae      ae      a
402 m  2    o       (a)e            ae
403 m  3    b       {\(a\)b}        ab      ab      a
404 m  4    -       a((b)c)         abc     abc     bc      b
405 m  5    -       a(b)(c)         abc     abc     b       c
406 e  6    -       a(b             EPAREN
407 e  7    b       {a\(b}          EPAREN
408 # sigh, we blew it on the specs here... someday this will be fixed in POSIX,
409 #  but meanwhile, it's fixed in AREs
410 m  8    eU      a)b             a)b     a)b
411 e  9    -       a)b             EPAREN
412 e 10    b       {a\)b}          EPAREN
413 m 11    P       a(?:b)c         abc     abc
414 e 12    e       a(?:b)c         BADRPT
415 i 13    S       a()b            ab      {0 1}   {1 0}
416 m 14    SP      a(?:)b          ab      ab
417 i 15    S       a(|b)c          ac      {0 1}   {1 0}
418 m 16    S       a(b|)c          abc     abc     b
419
420
421
422 doing 5 "simple one-char matching"
423 # general case of brackets done later
424 m  1    &       a.b             axb     axb
425 f  2    &n      "a.b"           "a\nb"
426 m  3    &       {a[bc]d}        abd     abd
427 m  4    &       {a[bc]d}        acd     acd
428 f  5    &       {a[bc]d}        aed
429 f  6    &       {a[^bc]d}       abd
430 m  7    &       {a[^bc]d}       aed     aed
431 f  8    &p      "a\[^bc]d"      "a\nd"
432
433
434
435 doing 6 "context-dependent syntax"
436 # plus odds and ends
437 e  1    -       *               BADRPT
438 m  2    b       *               *       *
439 m  3    b       {\(*\)}         *       *       *
440 e  4    -       (*)             BADRPT
441 m  5    b       ^*              *       *
442 e  6    -       ^*              BADRPT
443 f  7    &       ^b              ^b
444 m  8    b       x^              x^      x^
445 f  9    I       x^              x
446 m 10    n       "\n^"           "x\nb"  "\n"
447 f 11    bS      {\(^b\)}        ^b
448 m 12    -       (^b)            b       b       b
449 m 13    &       {x$}            x       x
450 m 14    bS      {\(x$\)}        x       x       x
451 m 15    -       {(x$)}          x       x       x
452 m 16    b       {x$y}           "x\$y"  "x\$y"
453 f 17    I       {x$y}           xy
454 m 18    n       "x\$\n"         "x\n"   "x\n"
455 e 19    -       +               BADRPT
456 e 20    -       ?               BADRPT
457
458
459
460 doing 7 "simple quantifiers"
461 m  1    &N      a*              aa      aa
462 i  2    &N      a*              b       {0 -1}
463 m  3    -       a+              aa      aa
464 m  4    -       a?b             ab      ab
465 m  5    -       a?b             b       b
466 e  6    -       **              BADRPT
467 m  7    bN      **              ***     ***
468 e  8    &       a**             BADRPT
469 e  9    &       a**b            BADRPT
470 e 10    &       ***             BADRPT
471 e 11    -       a++             BADRPT
472 e 12    -       a?+             BADRPT
473 e 13    -       a?*             BADRPT
474 e 14    -       a+*             BADRPT
475 e 15    -       a*+             BADRPT
476
477
478
479 doing 8 "braces"
480 m  1    NQ      "a{0,1}"        ""      ""
481 m  2    NQ      "a{0,1}"        ac      a
482 e  3    -       "a{1,0}"        BADBR
483 e  4    -       "a{1,2,3}"      BADBR
484 e  5    -       "a{257}"        BADBR
485 e  6    -       "a{1000}"       BADBR
486 e  7    -       "a{1"           EBRACE
487 e  8    -       "a{1n}"         BADBR
488 m  9    BS      "a{b"           "a\{b"  "a\{b"
489 m 10    BS      "a{"            "a\{"   "a\{"
490 m 11    bQ      "a\\{0,1\\}b"   cb      b
491 e 12    b       "a\\{0,1"       EBRACE
492 e 13    -       "a{0,1\\"       BADBR
493 m 14    Q       "a{0}b"         ab      b
494 m 15    Q       "a{0,0}b"       ab      b
495 m 16    Q       "a{0,1}b"       ab      ab
496 m 17    Q       "a{0,2}b"       b       b
497 m 18    Q       "a{0,2}b"       aab     aab
498 m 19    Q       "a{0,}b"        aab     aab
499 m 20    Q       "a{1,1}b"       aab     ab
500 m 21    Q       "a{1,3}b"       aaaab   aaab
501 f 22    Q       "a{1,3}b"       b
502 m 23    Q       "a{1,}b"        aab     aab
503 f 24    Q       "a{2,3}b"       ab
504 m 25    Q       "a{2,3}b"       aaaab   aaab
505 f 26    Q       "a{2,}b"        ab
506 m 27    Q       "a{2,}b"        aaaab   aaaab
507
508
509
510 doing 9 "brackets"
511 m  1    &       {a[bc]}         ac      ac
512 m  2    &       {a[-]}          a-      a-
513 m  3    &       {a[[.-.]]}      a-      a-
514 m  4    &L      {a[[.zero.]]}   a0      a0
515 m  5    &LM     {a[[.zero.]-9]} a2      a2
516 m  6    &M      {a[0-[.9.]]}    a2      a2
517 m  7    &+L     {a[[=x=]]}      ax      ax
518 m  8    &+L     {a[[=x=]]}      ay      ay
519 f  9    &+L     {a[[=x=]]}      az
520 e 10    &       {a[0-[=x=]]}    ERANGE
521 m 11    &L      {a[[:digit:]]}  a0      a0
522 e 12    &       {a[[:woopsie:]]}        ECTYPE
523 f 13    &L      {a[[:digit:]]}  ab
524 e 14    &       {a[0-[:digit:]]}        ERANGE
525 m 15    &LP     {[[:<:]]a}      a       a
526 m 16    &LP     {a[[:>:]]}      a       a
527 e 17    &       {a[[..]]b}      ECOLLATE
528 e 18    &       {a[[==]]b}      ECOLLATE
529 e 19    &       {a[[::]]b}      ECTYPE
530 e 20    &       {a[[.a}         EBRACK
531 e 21    &       {a[[=a}         EBRACK
532 e 22    &       {a[[:a}         EBRACK
533 e 23    &       {a[}            EBRACK
534 e 24    &       {a[b}           EBRACK
535 e 25    &       {a[b-}          EBRACK
536 e 26    &       {a[b-c}         EBRACK
537 m 27    &M      {a[b-c]}        ab      ab
538 m 28    &       {a[b-b]}        ab      ab
539 m 29    &M      {a[1-2]}        a2      a2
540 e 30    &       {a[c-b]}        ERANGE
541 e 31    &       {a[a-b-c]}      ERANGE
542 m 32    &M      {a[--?]b}       a?b     a?b
543 m 33    &       {a[---]b}       a-b     a-b
544 m 34    &       {a[]b]c}        a]c     a]c
545 m 35    EP      {a[\]]b}        a]b     a]b
546 f 36    bE      {a[\]]b}        a]b
547 m 37    bE      {a[\]]b}        "a\\]b" "a\\]b"
548 m 38    eE      {a[\]]b}        "a\\]b" "a\\]b"
549 m 39    EP      {a[\\]b}        "a\\b"  "a\\b"
550 m 40    eE      {a[\\]b}        "a\\b"  "a\\b"
551 m 41    bE      {a[\\]b}        "a\\b"  "a\\b"
552 e 42    -       {a[\Z]b}        EESCAPE
553 m 43    &       {a[[b]c}        "a\[c"  "a\[c"
554 m 44    EMP*    {a[\u00fe-\u0507][\u00ff-\u0300]b} \
555                         "a\u0102\u02ffb"        "a\u0102\u02ffb"
556
557
558
559 doing 10 "anchors and newlines"
560 m  1    &       ^a              a       a
561 f  2    &^      ^a              a
562 i  3    &N      ^               a       {0 -1}
563 i  4    &       {a$}            aba     {2 2}
564 f  5    {&$}    {a$}            a
565 i  6    &N      {$}             ab      {2 1}
566 m  7    &n      ^a              a       a
567 m  8    &n      "^a"            "b\na"  "a"
568 i  9    &w      "^a"            "a\na"  {0 0}
569 i 10    &n^     "^a"            "a\na"  {2 2}
570 m 11    &n      {a$}            a       a
571 m 12    &n      "a\$"           "a\nb"  "a"
572 i 13    &n      "a\$"           "a\na"  {0 0}
573 i 14    N       ^^              a       {0 -1}
574 m 15    b       ^^              ^       ^
575 i 16    N       {$$}            a       {1 0}
576 m 17    b       {$$}            "\$"    "\$"
577 m 18    &N      {^$}            ""      ""
578 f 19    &N      {^$}            a
579 i 20    &nN     "^\$"           "a\n\nb"        {2 1}
580 m 21    N       {$^}            ""      ""
581 m 22    b       {$^}            "\$^"   "\$^"
582 m 23    P       {\Aa}           a       a
583 m 24    ^P      {\Aa}           a       a
584 f 25    ^nP     {\Aa}           "b\na"
585 m 26    P       {a\Z}           a       a
586 m 27    {$P}    {a\Z}           a       a
587 f 28    {$nP}   {a\Z}           "a\nb"
588 e 29    -       ^*              BADRPT
589 e 30    -       {$*}            BADRPT
590 e 31    -       {\A*}           BADRPT
591 e 32    -       {\Z*}           BADRPT
592
593
594
595 doing 11 "boundary constraints"
596 m  1    &LP     {[[:<:]]a}      a       a
597 m  2    &LP     {[[:<:]]a}      -a      a
598 f  3    &LP     {[[:<:]]a}      ba
599 m  4    &LP     {a[[:>:]]}      a       a
600 m  5    &LP     {a[[:>:]]}      a-      a
601 f  6    &LP     {a[[:>:]]}      ab
602 m  7    bLP     {\<a}           a       a
603 f  8    bLP     {\<a}           ba
604 m  9    bLP     {a\>}           a       a
605 f 10    bLP     {a\>}           ab
606 m 11    LP      {\ya}           a       a
607 f 12    LP      {\ya}           ba
608 m 13    LP      {a\y}           a       a
609 f 14    LP      {a\y}           ab
610 m 15    LP      {a\Y}           ab      a
611 f 16    LP      {a\Y}           a-
612 f 17    LP      {a\Y}           a
613 f 18    LP      {-\Y}           -a
614 m 19    LP      {-\Y}           -%      -
615 f 20    LP      {\Y-}           a-
616 e 21    -       {[[:<:]]*}      BADRPT
617 e 22    -       {[[:>:]]*}      BADRPT
618 e 23    b       {\<*}           BADRPT
619 e 24    b       {\>*}           BADRPT
620 e 25    -       {\y*}           BADRPT
621 e 26    -       {\Y*}           BADRPT
622 m 27    LP      {\ma}           a       a
623 f 28    LP      {\ma}           ba
624 m 29    LP      {a\M}           a       a
625 f 30    LP      {a\M}           ab
626 f 31    ILP     {\Ma}           a
627 f 32    ILP     {a\m}           a
628
629
630
631 doing 12 "character classes"
632 m  1    LP      {a\db}          a0b     a0b
633 f  2    LP      {a\db}          axb
634 f  3    LP      {a\Db}          a0b
635 m  4    LP      {a\Db}          axb     axb
636 m  5    LP      "a\\sb"         "a b"   "a b"
637 m  6    LP      "a\\sb"         "a\tb"  "a\tb"
638 m  7    LP      "a\\sb"         "a\nb"  "a\nb"
639 f  8    LP      {a\sb}          axb
640 m  9    LP      {a\Sb}          axb     axb
641 f 10    LP      "a\\Sb"         "a b"
642 m 11    LP      {a\wb}          axb     axb
643 f 12    LP      {a\wb}          a-b
644 f 13    LP      {a\Wb}          axb
645 m 14    LP      {a\Wb}          a-b     a-b
646 m 15    LP      {\y\w+z\y}      adze-guz        guz
647 m 16    LPE     {a[\d]b}        a1b     a1b
648 m 17    LPE     "a\[\\s]b"      "a b"   "a b"
649 m 18    LPE     {a[\w]b}        axb     axb
650
651
652
653 doing 13 "escapes"
654 e  1    &       "a\\"           EESCAPE
655 m  2    -       {a\<b}          a<b     a<b
656 m  3    e       {a\<b}          a<b     a<b
657 m  4    bAS     {a\wb}          awb     awb
658 m  5    eAS     {a\wb}          awb     awb
659 m  6    PL      "a\\ab"         "a\007b"        "a\007b"
660 m  7    P       "a\\bb"         "a\bb"  "a\bb"
661 m  8    P       {a\Bb}          "a\\b"  "a\\b"
662 m  9    MP      "a\\chb"        "a\bb"  "a\bb"
663 m 10    MP      "a\\cHb"        "a\bb"  "a\bb"
664 m 11    LMP     "a\\e"          "a\033" "a\033"
665 m 12    P       "a\\fb"         "a\fb"  "a\fb"
666 m 13    P       "a\\nb"         "a\nb"  "a\nb"
667 m 14    P       "a\\rb"         "a\rb"  "a\rb"
668 m 15    P       "a\\tb"         "a\tb"  "a\tb"
669 m 16    P       "a\\u0008x"     "a\bx"  "a\bx"
670 e 17    -       {a\u008x}       EESCAPE
671 m 18    P       "a\\u00088x"    "a\b8x" "a\b8x"
672 m 19    P       "a\\U00000008x" "a\bx"  "a\bx"
673 e 20    -       {a\U0000008x}   EESCAPE
674 m 21    P       "a\\vb"         "a\vb"  "a\vb"
675 m 22    MP      "a\\x08x"       "a\bx"  "a\bx"
676 e 23    -       {a\xq}          EESCAPE
677 m 24    MP      "a\\x0008x"     "a\bx"  "a\bx"
678 e 25    -       {a\z}           EESCAPE
679 m 26    MP      "a\\010b"       "a\bb"  "a\bb"
680
681
682
683 doing 14 "back references"
684 # ugh
685 m  1    RP      {a(b*)c\1}      abbcbb  abbcbb  bb
686 m  2    RP      {a(b*)c\1}      ac      ac      ""
687 f  3    RP      {a(b*)c\1}      abbcb
688 m  4    RP      {a(b*)\1}       abbcbb  abb     b
689 m  5    RP      {a(b|bb)\1}     abbcbb  abb     b
690 m  6    RP      {a([bc])\1}     abb     abb     b
691 f  7    RP      {a([bc])\1}     abc
692 m  8    RP      {a([bc])\1}     abcabb  abb     b
693 f  9    RP      {a([bc])*\1}    abc
694 f 10    RP      {a([bc])\1}     abB
695 m 11    iRP     {a([bc])\1}     abB     abB     b
696 m 12    RP      {a([bc])\1+}    abbb    abbb    b
697 m 13    QRP     "a(\[bc])\\1{3,4}"      abbbb   abbbb   b
698 f 14    QRP     "a(\[bc])\\1{3,4}"      abbb
699 m 15    RP      {a([bc])\1*}    abbb    abbb    b
700 m 16    RP      {a([bc])\1*}    ab      ab      b
701 m 17    RP      {a([bc])(\1*)}  ab      ab      b       ""
702 e 18    -       {a((b)\1)}      ESUBREG
703 e 19    -       {a(b)c\2}       ESUBREG
704 m 20    bR      {a\(b*\)c\1}    abbcbb  abbcbb  bb
705
706
707
708 doing 15 "octal escapes vs back references"
709 # initial zero is always octal
710 m  1    MP      "a\\010b"       "a\bb"  "a\bb"
711 m  2    MP      "a\\0070b"      "a\0070b"       "a\0070b"
712 m  3    MP      "a\\07b"        "a\007b"        "a\007b"
713 m  4    MP      "a(b)(b)(b)(b)(b)(b)(b)(b)(b)(b)\\07c"  "abbbbbbbbbb\007c" \
714         "abbbbbbbbbb\007c"      "b"     "b"     "b"     "b"     "b"     "b" \
715         "b"     "b"     "b"     "b"
716 # a single digit is always a backref
717 e  5    -       {a\7b}          ESUBREG
718 # otherwise it's a backref only if within range (barf!)
719 m  6    MP      "a\\10b"        "a\bb"  "a\bb"
720 m  7    MP      {a\101b}        aAb     aAb
721 m  8    RP      {a(b)(b)(b)(b)(b)(b)(b)(b)(b)(b)\10c}   abbbbbbbbbbbc \
722         abbbbbbbbbbbc   b       b       b       b       b       b       b \
723         b       b       b
724 # but we're fussy about border cases -- guys who want octal should use the zero
725 e  9    -       {a((((((((((b\10))))))))))c}    ESUBREG
726 # BREs don't have octal, EREs don't have backrefs
727 m 10    MP      "a\\12b"        "a\nb"  "a\nb"
728 e 11    b       {a\12b}         ESUBREG
729 m 12    eAS     {a\12b}         a12b    a12b
730
731
732
733 doing 16 "expanded syntax"
734 m  1    xP      "a b c"         "abc"   "abc"
735 m  2    xP      "a b #oops\nc\td"       "abcd"  "abcd"
736 m  3    x       "a\\ b\\\tc"    "a b\tc"        "a b\tc"
737 m  4    xP      "a b\\#c"       "ab#c"  "ab#c"
738 m  5    xP      "a b\[c d]e"    "ab e"  "ab e"
739 m  6    xP      "a b\[c#d]e"    "ab#e"  "ab#e"
740 m  7    xP      "a b\[c#d]e"    "abde"  "abde"
741 m  8    xSPB    "ab{ d"         "ab\{d" "ab\{d"
742 m  9    xPQ     "ab{ 1 , 2 }c"  "abc"   "abc"
743
744
745
746 doing 17 "misc syntax"
747 m  1    P       a(?#comment)b   ab      ab
748
749
750
751 doing 18 "unmatchable REs"
752 f  1    I       a^b             ab
753
754
755
756 doing 19 "case independence"
757 m  1    &i      ab              Ab      Ab
758 m  2    &i      {a[bc]}         aC      aC
759 f  3    &i      {a[^bc]}        aB
760 m  4    &iM     {a[b-d]}        aC      aC
761 f  5    &iM     {a[^b-d]}       aC
762
763
764
765 doing 20 "directors and embedded options"
766 e  1    &       ***?            BADPAT
767 m  2    q       ***?            ***?    ***?
768 m  3    &P      ***=a*b         a*b     a*b
769 m  4    q       ***=a*b         ***=a*b ***=a*b
770 m  5    bLP     {***:\w+}       ab      ab
771 m  6    eLP     {***:\w+}       ab      ab
772 e  7    &       ***:***=a*b     BADRPT
773 m  8    &P      ***:(?b)a+b     a+b     a+b
774 m  9    P       (?b)a+b         a+b     a+b
775 e 10    e       {(?b)\w+}       BADRPT
776 m 11    bAS     {(?b)\w+}       (?b)w+  (?b)w+
777 m 12    iP      (?c)a           a       a
778 f 13    iP      (?c)a           A
779 m 14    APS     {(?e)\W+}       WW      WW
780 m 15    P       (?i)a+          Aa      Aa
781 f 16    P       "(?m)a.b"       "a\nb"
782 m 17    P       "(?m)^b"        "a\nb"  "b"
783 f 18    P       "(?n)a.b"       "a\nb"
784 m 19    P       "(?n)^b"        "a\nb"  "b"
785 f 20    P       "(?p)a.b"       "a\nb"
786 f 21    P       "(?p)^b"        "a\nb"
787 m 22    P       (?q)a+b         a+b     a+b
788 m 23    nP      "(?s)a.b"       "a\nb"  "a\nb"
789 m 24    xP      "(?t)a b"       "a b"   "a b"
790 m 25    P       "(?w)a.b"       "a\nb"  "a\nb"
791 m 26    P       "(?w)^b"        "a\nb"  "b"
792 m 27    P       "(?x)a b"       "ab"    "ab"
793 e 28    -       (?z)ab          BADOPT
794 m 29    P       (?ici)a+        Aa      Aa
795 e 30    P       (?i)(?q)a+      BADRPT
796 m 31    P       (?q)(?i)a+      (?i)a+  (?i)a+
797 m 32    P       (?qe)a+         a       a
798 m 33    xP      "(?q)a b"       "a b"   "a b"
799 m 34    P       "(?qx)a b"      "a b"   "a b"
800 m 35    P       (?qi)ab         Ab      Ab
801
802
803
804 doing 21 "capturing"
805 m  1    -       a(b)c           abc     abc     b
806 m  2    P       a(?:b)c         xabc    abc
807 m  3    -       a((b))c         xabcy   abc     b       b
808 m  4    P       a(?:(b))c       abcy    abc     b
809 m  5    P       a((?:b))c       abc     abc     b
810 m  6    P       a(?:(?:b))c     abc     abc
811 i  7    Q       "a(b){0}c"      ac      {0 1}   {-1 -1}
812 m  8    -       a(b)c(d)e       abcde   abcde   b       d
813 m  9    -       (b)c(d)e        bcde    bcde    b       d
814 m 10    -       a(b)(d)e        abde    abde    b       d
815 m 11    -       a(b)c(d)        abcd    abcd    b       d
816 m 12    -       (ab)(cd)        xabcdy  abcd    ab      cd
817 m 13    -       a(b)?c          xabcy   abc     b
818 i 14    -       a(b)?c          xacy    {1 2}   {-1 -1}
819 m 15    -       a(b)?c(d)?e     xabcdey abcde   b       d
820 i 16    -       a(b)?c(d)?e     xacdey  {1 4}   {-1 -1} {3 3}
821 i 17    -       a(b)?c(d)?e     xabcey  {1 4}   {2 2}   {-1 -1}
822 i 18    -       a(b)?c(d)?e     xacey   {1 3}   {-1 -1} {-1 -1}
823 m 19    -       a(b)*c          xabcy   abc     b
824 i 20    -       a(b)*c          xabbbcy {1 5}   {4 4}
825 i 21    -       a(b)*c          xacy    {1 2}   {-1 -1}
826 m 22    -       a(b*)c          xabbbcy abbbc   bbb
827 m 23    -       a(b*)c          xacy    ac      ""
828 f 24    -       a(b)+c          xacy
829 m 25    -       a(b)+c          xabcy   abc     b
830 i 26    -       a(b)+c          xabbbcy {1 5}   {4 4}
831 m 27    -       a(b+)c          xabbbcy abbbc   bbb
832 i 28    Q       "a(b){2,3}c"    xabbbcy {1 5}   {4 4}
833 i 29    Q       "a(b){2,3}c"    xabbcy  {1 4}   {3 3}
834 f 30    Q       "a(b){2,3}c"    xabcy
835 m 31    LP      "\\y(\\w+)\\y"  "-- abc-"       "abc"   "abc"
836 m 32    -       a((b|c)d+)+     abacdbd acdbd   bd      b
837 m 33    N       (.*).*          abc     abc     abc
838 m 34    N       (a*)*           bc      ""      ""
839
840
841
842 doing 22 "multicharacter collating elements"
843 # again ugh
844 m  1    &+L     {a[c]e}         ace     ace
845 f  2    &+IL    {a[c]h}         ach
846 m  3    &+L     {a[[.ch.]]}     ach     ach
847 f  4    &+L     {a[[.ch.]]}     ace
848 m  5    &+L     {a[c[.ch.]]}    ac      ac
849 m  6    &+L     {a[c[.ch.]]}    ace     ac
850 m  7    &+L     {a[c[.ch.]]}    ache    ach
851 f  8    &+L     {a[^c]e}        ace
852 m  9    &+L     {a[^c]e}        abe     abe
853 m 10    &+L     {a[^c]e}        ache    ache
854 f 11    &+L     {a[^[.ch.]]}    ach
855 m 12    &+L     {a[^[.ch.]]}    ace     ac
856 m 13    &+L     {a[^[.ch.]]}    ac      ac
857 m 14    &+L     {a[^[.ch.]]}    abe     ab
858 f 15    &+L     {a[^c[.ch.]]}   ach
859 f 16    &+L     {a[^c[.ch.]]}   ace
860 f 17    &+L     {a[^c[.ch.]]}   ac
861 m 18    &+L     {a[^c[.ch.]]}   abe     ab
862 m 19    &+L     {a[^b]}         ac      ac
863 m 20    &+L     {a[^b]}         ace     ac
864 m 21    &+L     {a[^b]}         ach     ach
865 f 22    &+L     {a[^b]}         abe
866
867
868
869 doing 23 "lookahead constraints"
870 m  1    HP      a(?=b)b*        ab      ab
871 f  2    HP      a(?=b)b*        a
872 m  3    HP      a(?=b)b*(?=c)c* abc     abc
873 f  4    HP      a(?=b)b*(?=c)c* ab
874 f  5    HP      a(?!b)b*        ab
875 m  6    HP      a(?!b)b*        a       a
876 m  7    HP      (?=b)b          b       b
877 f  8    HP      (?=b)b          a
878
879
880
881 doing 24 "non-greedy quantifiers"
882 m  1    PT      ab+?            abb     ab
883 m  2    PT      ab+?c           abbc    abbc
884 m  3    PT      ab*?            abb     a
885 m  4    PT      ab*?c           abbc    abbc
886 m  5    PT      ab??            ab      a
887 m  6    PT      ab??c           abc     abc
888 m  7    PQT     "ab{2,4}?"      abbbb   abb
889 m  8    PQT     "ab{2,4}?c"     abbbbc  abbbbc
890 m  9    -       3z*             123zzzz456      3zzzz
891 m 10    PT      3z*?            123zzzz456      3
892 m 11    -       z*4             123zzzz456      zzzz4
893 m 12    PT      z*?4            123zzzz456      zzzz4
894
895
896
897 doing 25 "mixed quantifiers"
898 # this is very incomplete as yet
899 # should include |
900 m  1    PNT     {^(.*?)(a*)$}   xyza    xyza    xyz     a
901 m  2    PNT     {^(.*?)(a*)$}   xyzaa   xyzaa   xyz     aa
902 m  3    PNT     {^(.*?)(a*)$}   xyz     xyz     xyz     ""
903
904
905
906 doing 26 "tricky cases"
907 # attempts to trick the matcher into accepting a short match
908 m  1    -       (week|wee)(night|knights)       weeknights      weeknights \
909         wee     knights
910 m  2    RP      {a(bc*).*\1}    abccbccb        abccbccb        b
911 m  3    -       {a(b.[bc]*)+}   abcbd   abcbd   bd
912
913
914
915 doing 27 "implementation misc."
916 # duplicate arcs are suppressed
917 m  1    P       a(?:b|b)c       abc     abc
918 # make color/subcolor relationship go back and forth
919 m  2    &       {[ab][ab][ab]}  aba     aba
920 m  3    &       {[ab][ab][ab][ab][ab][ab][ab]}  abababa abababa
921
922
923
924 doing 28 "boundary busters etc."
925 # color-descriptor allocation changes at 10
926 m  1    &       abcdefghijkl    abcdefghijkl    abcdefghijkl
927 # so does arc allocation
928 m  2    P       a(?:b|c|d|e|f|g|h|i|j|k|l|m)n   agn     agn
929 # subexpression tracking also at 10
930 m  3    -       a(((((((((((((b)))))))))))))c   abc     abc     b       b       b       b       b       b       b       b       b       b       b       b       b
931 # state-set handling changes slightly at unsigned size (might be 64...)
932 # (also stresses arc allocation)
933 m  4    Q       "ab{1,100}c"    abbc    abbc
934 m  5    Q       "ab{1,100}c"    abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc \
935         abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc
936 m  6    Q       "ab{1,100}c" \
937         abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc \
938         abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc
939 # force small cache and bust it, several ways
940 m  7    LP      {\w+abcdefgh}   xyzabcdefgh     xyzabcdefgh
941 m  8    %LP     {\w+abcdefgh}   xyzabcdefgh     xyzabcdefgh
942 m  9    %LP     {\w+abcdefghijklmnopqrst}       xyzabcdefghijklmnopqrst \
943         xyzabcdefghijklmnopqrst
944 i 10    %LP     {\w+(abcdefgh)?}        xyz     {0 2}   {-1 -1}
945 i 11    %LP     {\w+(abcdefgh)?}        xyzabcdefg      {0 9}   {-1 -1}
946 i 12    %LP     {\w+(abcdefghijklmnopqrst)?}    xyzabcdefghijklmnopqrs \
947         {0 21}  {-1 -1}
948
949
950
951 doing 29 "incomplete matches"
952 p  1    t       def             abc     {3 2}   ""
953 p  2    t       bcd             abc     {1 2}   ""
954 p  3    t       abc             abab    {0 3}   ""
955 p  4    t       abc             abdab   {3 4}   ""
956 i  5    t       abc             abc     {0 2}   {0 2}
957 i  6    t       abc             xyabc   {2 4}   {2 4}
958 p  7    t       abc+            xyab    {2 3}   ""
959 i  8    t       abc+            xyabc   {2 4}   {2 4}
960 knownBug i  9   t       abc+            xyabcd  {2 4}   {6 5}
961 i  10   t       abc+            xyabcdd {2 4}   {7 6}
962 p  11   tPT     abc+?           xyab    {2 3}   ""
963 # the retain numbers in these two may look wrong, but they aren't
964 i  12   tPT     abc+?           xyabc   {2 4}   {5 4}
965 i  13   tPT     abc+?           xyabcc  {2 4}   {6 5}
966 i  14   tPT     abc+?           xyabcd  {2 4}   {6 5}
967 i  15   tPT     abc+?           xyabcdd {2 4}   {7 6}
968 i  16   t       abcd|bc         xyabc   {3 4}   {2 4}
969 p  17   tn      .*k             "xx\nyyy"       {3 5}   ""
970
971
972 doing 30 "misc. oddities and old bugs"
973 e  1    &       ***             BADRPT
974 m  2    N       a?b*            abb     abb
975 m  3    N       a?b*            bb      bb
976 m  4    &       a*b             aab     aab
977 m  5    &       ^a*b            aaaab   aaaab
978 m  6    &M      {[0-6][1-2][0-3][0-6][1-6][0-6]}        010010  010010
979 # temporary REG_BOSONLY kludge
980 m  7    s       abc             abcd    abc
981 f  8    s       abc             xabcd
982 # back to normal stuff
983 m  9    HLP     {(?n)^(?![t#])\S+}      "tk\n\n#\n#\nit0"       it0
984
985
986 # flush any leftover complaints
987 doing 0 "flush"
988
989 # Tests resulting from bugs reported by users
990 test reg-31.1 {[[:xdigit:]] behaves correctly when followed by [[:space:]]} {
991     set str {2:::DebugWin32}
992     set re {([[:xdigit:]])([[:space:]]*)}
993     list [regexp $re $str match xdigit spaces] $match $xdigit $spaces
994     # Code used to produce {1 2:::DebugWin32 2 :::DebugWin32} !!!
995 } {1 2 2 {}}
996
997 test reg-32.1 {canmatch functionality -- at end} {
998     set pat {blah}
999     set line "asd asd"
1000     # can match at the final d, if '%' follows
1001     set res [testregexp -xflags -- c $pat $line resvar]
1002     lappend res $resvar
1003 } {0 7}
1004
1005 test reg-32.2 {canmatch functionality -- at end} {
1006     set pat {s%$}
1007     set line "asd asd"
1008     # can only match after the end of the string
1009     set res [testregexp -xflags -- c $pat $line resvar] 
1010     lappend res $resvar
1011 } {0 7}
1012
1013 test reg-32.3 {canmatch functionality -- not last char} {
1014     set pat {[^d]%$}
1015     set line "asd asd"
1016     # can only match after the end of the string
1017     set res [testregexp -xflags -- c $pat $line resvar]
1018     lappend res $resvar
1019 } {0 7}
1020
1021 test reg-32.3.1 {canmatch functionality -- no match} {
1022     set pat {\Zx}
1023     set line "asd asd"
1024     # can match the last char, if followed by x
1025     set res [testregexp -xflags -- c $pat $line resvar]
1026     lappend res $resvar
1027 } {0 -1}
1028
1029 test reg-32.4 {canmatch functionality -- last char} {knownBug} {
1030     set pat {.x}
1031     set line "asd asd"
1032     # can match the last char, if followed by x
1033     set res [testregexp -xflags -- c $pat $line resvar]
1034     lappend res $resvar
1035 } {0 6}
1036
1037 test reg-32.4.1 {canmatch functionality -- last char} {knownBug} {
1038     set pat {.x$}
1039     set line "asd asd"
1040     # can match the last char, if followed by x
1041     set res [testregexp -xflags -- c $pat $line resvar]
1042     lappend res $resvar
1043 } {0 6}
1044
1045 test reg-32.5 {canmatch functionality -- last char} {knownBug} {
1046     set pat {.[^d]x$}
1047     set line "asd asd"
1048     # can match the last char, if followed by not-d and x.
1049     set res [testregexp -xflags -- c $pat $line resvar]
1050     lappend res $resvar
1051 } {0 6}
1052
1053 test reg-32.6 {canmatch functionality -- last char} {knownBug} {
1054     set pat {[^a]%[^\r\n]*$}
1055     set line "asd asd"
1056     # can match at the final d, if '%' follows
1057     set res [testregexp -xflags -- c $pat $line resvar]
1058     lappend res $resvar
1059 } {0 6}
1060
1061 test reg-32.7 {canmatch functionality -- last char} {knownBug} {
1062     set pat {[^a]%$}
1063     set line "asd asd"
1064     # can match at the final d, if '%' follows
1065     set res [testregexp -xflags -- c $pat $line resvar]
1066     lappend res $resvar
1067 } {0 6}
1068
1069 test reg-32.8 {canmatch functionality -- last char} {knownBug} {
1070     set pat {[^x]%$}
1071     set line "asd asd"
1072     # can match at the final d, if '%' follows
1073     set res [testregexp -xflags -- c $pat $line resvar]
1074     lappend res $resvar
1075 } {0 6}
1076
1077 test reg-32.9 {canmatch functionality -- more complex case} {knownBug} {
1078     set pat {((\B\B|\Bh+line)[ \t]*|[^\B]%[^\r\n]*)$}
1079     set line "asd asd"
1080     # can match at the final d, if '%' follows
1081     set res [testregexp -xflags -- c $pat $line resvar]
1082     lappend res $resvar
1083 } {0 6}
1084
1085 # Tests reg-33.*: Checks for bug fixes
1086
1087 test reg-33.1 {Bug 230589} {
1088     regexp {[ ]*(^|[^%])%V} "*%V2" m s
1089 } 1
1090
1091 test reg-33.2 {Bug 504785} {
1092     regexp -inline {([^_.]*)([^.]*)\.(..)(.).*} bbcos_001_c01.q1la
1093 } {bbcos_001_c01.q1la bbcos _001_c01 q1 l}
1094
1095 test reg-33.3 {Bug 505048} {
1096     regexp {\A\s*[^<]*\s*<([^>]+)>} a<a>
1097 } 1
1098
1099 test reg-33.4 {Bug 505048} {
1100     regexp {\A\s*([^b]*)b} ab
1101 } 1
1102
1103 test reg-33.5 {Bug 505048} {
1104     regexp {\A\s*[^b]*(b)} ab
1105 } 1
1106
1107 test reg-33.6 {Bug 505048} {
1108     regexp {\A(\s*)[^b]*(b)} ab
1109 } 1
1110
1111 test reg-33.7 {Bug 505048} {
1112     regexp {\A\s*[^b]*b} ab
1113 } 1
1114
1115 test reg-33.8 {Bug 505048} {
1116     regexp -inline {\A\s*[^b]*b} ab
1117 } ab
1118
1119 test reg-33.9 {Bug 505048} {
1120     regexp -indices -inline {\A\s*[^b]*b} ab
1121 } {{0 1}}
1122
1123 test reg-33.10 {Bug 840258} {
1124     regsub {(^|\n)+\.*b} \n.b {} tmp
1125 } 1
1126
1127 test reg-33.11 {Bug 840258} {
1128     regsub {(^|[\n\r]+)\.*\?<.*?(\n|\r)+} \
1129             "TQ\r\n.?<5000267>Test already stopped\r\n" {} tmp
1130 } 1
1131
1132 # cleanup
1133 ::tcltest::cleanupTests
1134 return