1 # Commands covered: regexp, regsub
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.
7 # Copyright (c) 1991-1993 The Regents of the University of California.
8 # Copyright (c) 1998 Sun Microsystems, Inc.
9 # Copyright (c) 1998-1999 by Scriptics Corporation.
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 source [file dirname [info script]]/testing.tcl
19 testConstraint regexp_are [regexp {\d} 1]
20 needs constraint regexp_are
22 # Procedure to evaluate a script within a proc, to test compilation
25 proc evalInProc { script } {
26 proc testProc {} $script
32 #return [list $status $result]
36 test regexpComp-1.1 {basic regexp operation} {
41 test regexpComp-1.2 {basic regexp operation} {
46 test regexpComp-1.3 {basic regexp operation} {
51 test regexpComp-1.4 {basic regexp operation} {
53 regexp -- -gorp abc-gorpxxx
56 test regexpComp-1.5 {basic regexp operation} {
58 regexp {^([^ ]*)[ ]*([^ ]*)} "" a
61 test regexpComp-1.6 {basic regexp operation} {
62 list [catch {regexp {} abc} msg] $msg
64 test regexpComp-1.7 {regexp utf compliance} {
65 # if not UTF-8 aware, result is "0 1"
68 regexp "\u4e4eb q" "a\u4e4eb qw\u5e4e\x4e wq" bar
69 list [string compare $foo $bar] [regexp 4 $bar]
73 test regexpComp-2.1 {getting substrings back from regexp} {
76 list [regexp ab*c abbbbc foo] $foo
79 test regexpComp-2.2 {getting substrings back from regexp} {
83 list [regexp a(b*)c abbbbc foo f2] $foo $f2
86 test regexpComp-2.3 {getting substrings back from regexp} {
90 list [regexp a(b*)(c) abbbbc foo f2] $foo $f2
93 test regexpComp-2.4 {getting substrings back from regexp} {
98 list [regexp a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3
101 test regexpComp-2.5 {getting substrings back from regexp} {
103 set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {};
104 set f6 {}; set f7 {}; set f8 {}; set f9 {}; set fa {}; set fb {};
105 list [regexp (1*)(2*)(3*)(4*)(5*)(6*)(7*)(8*)(9*)(a*)(b*) \
106 12223345556789999aabbb \
107 foo f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb] $foo $f1 $f2 $f3 $f4 $f5 \
108 $f6 $f7 $f8 $f9 $fa $fb
110 } {1 12223345556789999aabbb 1 222 33 4 555 6 7 8 9999 aa bbb}
111 test regexpComp-2.6 {getting substrings back from regexp} {
113 set foo 2; set f2 2; set f3 2; set f4 2
114 list [regexp (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4
117 test regexpComp-2.7 {getting substrings back from regexp} {
119 set foo 1; set f2 1; set f3 1; set f4 1
120 list [regexp (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4
123 test regexpComp-2.8 {getting substrings back from regexp} {
126 list [regexp {^a*b} aaaab match] $match
130 test regexpComp-3.1 {-indices option to regexp} {
133 list [regexp -indices ab*c abbbbc foo] $foo
136 test regexpComp-3.2 {-indices option to regexp} {
140 list [regexp -indices a(b*)c abbbbc foo f2] $foo $f2
143 test regexpComp-3.3 {-indices option to regexp} {
147 list [regexp -indices a(b*)(c) abbbbc foo f2] $foo $f2
150 test regexpComp-3.4 {-indices option to regexp} {
155 list [regexp -indices a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3
157 } {1 {0 5} {1 4} {5 5}}
158 test regexpComp-3.5 {-indices option to regexp} {
160 set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {};
161 set f6 {}; set f7 {}; set f8 {}; set f9 {}
162 list [regexp -indices (1*)(2*)(3*)(4*)(5*)(6*)(7*)(8*)(9*) \
164 foo f1 f2 f3 f4 f5 f6 f7 f8 f9] $foo $f1 $f2 $f3 $f4 $f5 \
167 } {1 {0 16} {0 0} {1 3} {4 5} {6 6} {7 9} {10 10} {11 11} {12 12} {13 16}}
168 test regexpComp-3.6 {getting substrings back from regexp} {
170 set foo 2; set f2 2; set f3 2; set f4 2
171 list [regexp -indices (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4
173 } {1 {1 1} {1 1} {-1 -1} {-1 -1}}
174 test regexpComp-3.7 {getting substrings back from regexp} {
176 set foo 1; set f2 1; set f3 1; set f4 1
177 list [regexp -indices (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4
179 } {1 {1 2} {1 1} {-1 -1} {2 2}}
181 test regexpComp-4.1 {-nocase option to regexp} {
183 regexp -nocase foo abcFOo
186 test regexpComp-4.2 {-nocase option to regexp} {
191 list [regexp -nocase {a(b*)([xy]*)z} aBbbxYXxxZ22 f1 f2 f3] $f1 $f2 $f3
193 } {1 aBbbxYXxxZ Bbb xYXxx}
194 test regexpComp-4.3 {-nocase option to regexp} {
196 regexp -nocase FOo abcFOo
199 set ::x abcdefghijklmnopqrstuvwxyz1234567890
200 set ::x $x$x$x$x$x$x$x$x$x$x$x$x
201 test regexpComp-4.4 {case conversion in regexp} {
203 list [regexp -nocase $::x $::x foo] $foo
208 test regexpComp-5.1 {exercise cache of compiled expressions} {
218 test regexpComp-5.2 {exercise cache of compiled expressions} {
228 test regexpComp-5.3 {exercise cache of compiled expressions} {
238 test regexpComp-5.4 {exercise cache of compiled expressions} {
248 test regexpComp-5.5 {exercise cache of compiled expressions} {
259 test regexpComp-6.4 {regexp errors} {
261 list [catch {regexp a( b} msg] $msg
263 } {1 {couldn't compile regular expression pattern: parentheses () not balanced}}
264 test regexpComp-6.5 {regexp errors} {
266 list [catch {regexp a( b} msg] $msg
268 } {1 {couldn't compile regular expression pattern: parentheses () not balanced}}
269 test regexpComp-6.6 {regexp errors} {
271 list [catch {regexp a a f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1} msg] $msg
274 test regexpComp-6.7 {regexp errors} {
276 list [catch {regexp (x)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.) xyzzy} msg] $msg
279 test regexpComp-6.8 {regexp errors} {
283 catch {regexp abc abc f1(f2)} msg
286 test regexpComp-6.9 {regexp errors, -start bad int check} {
288 list [catch {regexp -start bogus {^$} {}} msg] $msg
290 } {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
292 test regexpComp-7.1 {basic regsub operation} {
294 list [regsub aa+ xaxaaaxaa 111&222 foo] $foo
296 } {1 xax111aaa222xaa}
297 test regexpComp-7.2 {basic regsub operation} {
299 list [regsub aa+ aaaxaa &111 foo] $foo
302 test regexpComp-7.3 {basic regsub operation} {
304 list [regsub aa+ xaxaaa 111& foo] $foo
307 test regexpComp-7.4 {basic regsub operation} {
309 list [regsub aa+ aaa 11&2&333 foo] $foo
312 test regexpComp-7.5 {basic regsub operation} {
314 list [regsub aa+ xaxaaaxaa &2&333 foo] $foo
316 } {1 xaxaaa2aaa333xaa}
317 test regexpComp-7.6 {basic regsub operation} {
319 list [regsub aa+ xaxaaaxaa 1&22& foo] $foo
321 } {1 xax1aaa22aaaxaa}
322 test regexpComp-7.7 {basic regsub operation} {
324 list [regsub a(a+) xaxaaaxaa {1\122\1} foo] $foo
327 test regexpComp-7.8 {basic regsub operation} {
329 list [regsub a(a+) xaxaaaxaa {1\\\122\1} foo] $foo
331 } "1 {xax1\\aa22aaxaa}"
332 test regexpComp-7.9 {basic regsub operation} {
334 list [regsub a(a+) xaxaaaxaa {1\\122\1} foo] $foo
336 } "1 {xax1\\122aaxaa}"
337 test regexpComp-7.10 {basic regsub operation} {
339 list [regsub a(a+) xaxaaaxaa {1\\&\1} foo] $foo
341 } "1 {xax1\\aaaaaxaa}"
342 test regexpComp-7.11 {basic regsub operation} {
344 list [regsub a(a+) xaxaaaxaa {1\&\1} foo] $foo
347 test regexpComp-7.12 {basic regsub operation} {
349 list [regsub a(a+) xaxaaaxaa {\1\1\1\1&&} foo] $foo
351 } {1 xaxaaaaaaaaaaaaaaxaa}
352 test regexpComp-7.13 {basic regsub operation} {
355 list [regsub abc xyz 111 foo] $foo
358 test regexpComp-7.14 {basic regsub operation} {
361 list [regsub ^ xyz "111 " foo] $foo
364 test regexpComp-7.15 {basic regsub operation} {
367 list [regsub -- -foo abc-foodef "111 " foo] $foo
370 test regexpComp-7.16 {basic regsub operation} {
373 list [regsub x "" y foo] $foo
376 test regexpComp-7.17 {regsub utf compliance} {
378 # if not UTF-8 aware, result is "0 1"
379 set foo "xyz555ijka\u4e4ebpqr"
380 regsub a\u4e4eb xyza\u4e4ebijka\u4e4ebpqr 555 bar
381 list [string compare $foo $bar] [regexp 4 $bar]
385 test regexpComp-7.18 {regsub utf8 in char range} utf8 {
386 regsub {[\u4e4ex]b} xyza\u4e4ebijka\u4e4ebpqr 555
387 } xyza555ijka\u4e4ebpqr
389 test regexpComp-7.19 {regsub utf8 in complemented char range} utf8 {
390 regsub -all {[^x\u4e4e]b} xyza\u4e4ebizbjxbka\u4e4fbpqr 555
391 } xyza\u4e4ebi555jxbka555pqr
393 test regexpComp-8.1 {case conversion in regsub} {
395 list [regsub -nocase a(a+) xaAAaAAay & foo] $foo
398 test regexpComp-8.2 {case conversion in regsub} {
400 list [regsub -nocase a(a+) xaAAaAAay & foo] $foo
403 test regexpComp-8.3 {case conversion in regsub} {
406 list [regsub a(a+) xaAAaAAay & foo] $foo
409 test regexpComp-8.4 {case conversion in regsub} {
412 list [regsub -nocase a CaDE b foo] $foo
415 test regexpComp-8.5 {case conversion in regsub} {
418 list [regsub -nocase XYZ CxYzD b foo] $foo
421 test regexpComp-8.6 {case conversion in regsub} {
423 set x abcdefghijklmnopqrstuvwxyz1234567890
424 set x $x$x$x$x$x$x$x$x$x$x$x$x
426 list [regsub -nocase $x $x b foo] $foo
430 test regexpComp-9.1 {-all option to regsub} {
433 list [regsub -all x+ axxxbxxcxdx |&| foo] $foo
435 } {4 a|xxx|b|xx|c|x|d|x|}
436 test regexpComp-9.2 {-all option to regsub} {
439 list [regsub -nocase -all x+ aXxXbxxcXdx |&| foo] $foo
441 } {4 a|XxX|b|xx|c|X|d|x|}
442 test regexpComp-9.3 {-all option to regsub} {
445 list [regsub x+ axxxbxxcxdx |&| foo] $foo
448 test regexpComp-9.4 {-all option to regsub} {
451 list [regsub -all bc axxxbxxcxdx |&| foo] $foo
454 test regexpComp-9.5 {-all option to regsub} {
457 list [regsub -all node "node node more" yy foo] $foo
460 test regexpComp-9.6 {-all option to regsub} {
463 list [regsub -all ^ xxx 123 foo] $foo
467 #test regexpComp-10.1 {expanded syntax in regsub} {
470 # list [regsub -expanded ". \#comment\n . \#comment2" abc def foo] $foo
473 test regexpComp-10.2 {newline sensitivity in regsub} {
476 list [regsub -line {^a.*b$} "dabc\naxyb\n" 123 foo] $foo
479 test regexpComp-10.3 {newline sensitivity in regsub} {
482 list [regsub -line {^a.*b$} "dabc\naxyb\nxb" 123 foo] $foo
484 } "1 {dabc\n123\nxb}"
485 #test regexpComp-10.4 {partial newline sensitivity in regsub} {
488 # list [regsub -lineanchor {^a.*b$} "da\naxyb\nxb" 123 foo] $foo
491 #test regexpComp-10.5 {inverse partial newline sensitivity in regsub} {
494 # list [regsub -linestop {a.*b} "da\nbaxyb\nxb" 123 foo] $foo
496 #} "1 {da\nb123\nxb}"
498 test regexpComp-11.1 {regsub errors} {
500 list [catch {regsub a b} msg] $msg
502 } {1 {wrong # args: should be "regsub ?-switch ...? exp string subSpec ?varName?"}}
503 test regexpComp-11.2 {regsub errors} {
505 list [catch {regsub -nocase a b} msg] $msg
507 } {1 {wrong # args: should be "regsub ?-switch ...? exp string subSpec ?varName?"}}
508 test regexpComp-11.3 {regsub errors} {
510 list [catch {regsub -nocase -all a b} msg] $msg
512 } {1 {wrong # args: should be "regsub ?-switch ...? exp string subSpec ?varName?"}}
513 test regexpComp-11.4 {regsub errors} {
515 list [catch {regsub a b c d e f} msg] $msg
517 } {1 {wrong # args: should be "regsub ?-switch ...? exp string subSpec ?varName?"}}
518 #test regexpComp-11.5 {regsub errors} {
520 # list [catch {regsub -gorp a b c} msg] $msg
522 #} {1 {bad switch "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}}
523 test regexpComp-11.6 {regsub errors} {
525 list [catch {regsub -nocase a( b c d} msg] $msg
527 } {1 {couldn't compile regular expression pattern: parentheses () not balanced}}
528 test regexpComp-11.7 {regsub errors} {
532 catch {regsub -nocase aaa aaa xxx f1(f2)} msg
535 test regexpComp-11.8 {regsub errors, -start bad int check} {
537 list [catch {regsub -start bogus pattern string rep var} msg] $msg
539 } {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
541 # This test crashes on the Mac unless you increase the Stack Space to about 1
542 # Meg. This is probably bigger than most users want...
543 # 8.2.3 regexp reduced stack space requirements, but this should be
545 test regexpComp-12.1 {Tcl_RegExpExec: large number of subexpressions} {
547 list [regexp (.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.) abcdefghijklmnopqrstuvwxyz all a b c d e f g h i j k l m n o p q r s t u v w x y z] $all $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z
549 } {1 abcdefghijklmnopqrstuvwxyz a b c d e f g h i j k l m n o p q r s t u v w x y z}
551 test regexpComp-13.1 {regsub of a very large string} {
552 # This test is designed to stress the memory subsystem in order
553 # to catch Bug #933. It only fails if the Tcl memory allocator
556 set line {BEGIN_TABLE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; END_TABLE}
557 set filedata [string repeat $line 200]
558 for {set i 1} {$i<10} {incr i} {
559 regsub -all "BEGIN_TABLE " $filedata "" newfiledata
564 test regexpComp-14.1 {CompileRegexp: regexp cache} {
576 test regexpComp-14.2 {CompileRegexp: regexp cache, different flags} {
585 regexp -nocase $x bbba
589 test regexpComp-15.1 {regexp -start} {
591 list [regexp -start -10 {\d} 1abc2de3 x] $x
593 test regexpComp-15.2 {regexp -start} {
595 list [regexp -start 2 {\d} 1abc2de3 x] $x
597 test regexpComp-15.3 {regexp -start} {
599 list [regexp -start 4 {\d} 1abc2de3 x] $x
601 test regexpComp-15.4 {regexp -start} {
603 list [regexp -start 5 {\d} 1abc2de3 x] $x
605 test regexpComp-15.5 {regexp -start, over end of string} {
607 list [regexp -start [string length 1abc2de3] {\d} 1abc2de3 x] [info exists x]
609 test regexpComp-15.6 {regexp -start, loss of ^$ behavior} {
610 list [regexp -start 2 {^$} {}]
613 test regexpComp-16.1 {regsub -start} {
615 list [regsub -all -start 2 {\d} a1b2c3d4e5 {/&} x] $x
617 test regexpComp-16.2 {regsub -start} {
619 list [regsub -all -start -25 {z} hello {/&} x] $x
621 test regexpComp-16.3 {regsub -start} {
623 list [regsub -all -start 3 {z} hello {/&} x] $x
625 #test regexpComp-16.4 {regsub -start, \A behavior} {
627 # lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x
628 # lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x
629 #} {5 /a/b/c/d/e 3 ab/c/d/e}
630 test regexpComp-16.5 {regexp -start with utf8} utf8 {
631 regexp -inline -start 1 . \u0442\u0435\u0441\u0442
633 test regexpComp-16.6 {regexp -start with utf8} utf8 {
634 regsub -start 1 . \u0442\u0435\u0441\u0442 x
635 } \u0442x\u0441\u0442
637 test regexpComp-17.1 {regexp -inline} {
638 regexp -inline b ababa
640 test regexpComp-17.2 {regexp -inline} {
641 regexp -inline (b) ababa
643 test regexpComp-17.3 {regexp -inline -indices} {
644 regexp -inline -indices (b) ababa
646 test regexpComp-17.4 {regexp -inline} {
647 regexp -inline {\w(\d+)\w} " hello 23 there456def "
649 test regexpComp-17.5 {regexp -inline no matches} {
650 regexp -inline {\w(\d+)\w} ""
652 test regexpComp-17.6 {regexp -inline no matches} {
653 regexp -inline hello goodbye
655 test regexpComp-17.7 {regexp -inline, no matchvars allowed} {
656 list [catch {regexp -inline b abc match} msg] $msg
657 } {1 {regexp match variables not allowed when using -inline}}
658 test regexpComp-17.8 {regexp -indices utf8} utf8 {
659 regexp -all -inline -start 1 -indices . \u0442\u0435\u0441\u0442
660 } {{1 1} {2 2} {3 3}}
662 test regexpComp-18.1 {regexp -all} {
665 test regexpComp-18.2 {regexp -all} {
666 regexp -all b abababbabaaaaaaaaaab
668 test regexpComp-18.3 {regexp -all -inline} {
669 regexp -all -inline b abababbabaaaaaaaaaab
671 test regexpComp-18.4 {regexp -all -inline} {
672 regexp -all -inline {\w(\w)} abcdefg
674 test regexpComp-18.5 {regexp -all -inline} {
675 regexp -all -inline {\w(\w)$} abcdefg
677 test regexpComp-18.6 {regexp -all -inline} {
678 regexp -all -inline {\d+} 10:20:30:40
680 test regexpComp-18.7 {regexp -all -inline} {
681 list [catch {regexp -all -inline b abc match} msg] $msg
682 } {1 {regexp match variables not allowed when using -inline}}
683 test regexpComp-18.8 {regexp -all} {
684 # This should not cause an infinite loop
685 regexp -all -inline {a*} a
687 test regexpComp-18.9 {regexp -all} {
688 # Yes, the expected result is {a {}}. Here's why:
689 # Start at index 0; a* matches the "a" there then stops.
690 # Go to index 1; a* matches the lambda (or {}) there then stops. Recall
691 # that a* matches zero or more "a"'s; thus it matches the string "b", as
692 # there are zero or more "a"'s there.
693 # Go to index 2; this is past the end of the string, so stop.
694 regexp -all -inline {a*} ab
696 test regexpComp-18.10 {regexp -all} {
697 # Yes, the expected result is {a {} a}. Here's why:
698 # Start at index 0; a* matches the "a" there then stops.
699 # Go to index 1; a* matches the lambda (or {}) there then stops. Recall
700 # that a* matches zero or more "a"'s; thus it matches the string "b", as
701 # there are zero or more "a"'s there.
702 # Go to index 2; a* matches the "a" there then stops.
703 # Go to index 3; this is past the end of the string, so stop.
704 regexp -all -inline {a*} aba
706 test regexpComp-18.11 {regexp -all} {
708 regexp -all -inline {^a} aaaa
711 test regexpComp-18.12 {regexp -all -inline -indices} {
713 regexp -all -inline -indices a(b(c)d|e(f)g)h abcdhaefgh
715 } {{0 4} {1 3} {2 2} {-1 -1} {5 9} {6 8} {-1 -1} {7 7}}
717 test regexpComp-19.1 {regsub null replacement} {
719 regsub -all {@} {@hel@lo@} "\0a\0" result
720 list $result [string length $result]
722 } "\0a\0hel\0a\0lo\0a\0 14"
724 test regexpComp-20.1 {regsub shared object shimmering} {
727 set a abcdefghijklmnopqurstuvwxyz
729 set c abcdefghijklmnopqurstuvwxyz0123456789
731 list $d [string length $d] [string bytelength $d]
733 } [list abcdefghijklmnopqurstuvwxyz0123456789 37 37]
734 #test regexpComp-20.2 {regsub shared object shimmering with -about} {
736 # eval regexp -about abc
740 test regexpComp-21.1 {regexp command compiling tests} {
745 test regexpComp-21.2 {regexp command compiling tests} {
747 regexp {^foo$} dogfood
750 test regexpComp-21.3 {regexp command compiling tests} {
756 test regexpComp-21.4 {regexp command compiling tests} {
761 test regexpComp-21.5 {regexp command compiling tests} {
763 regexp -nocase FOO dogfod
766 test regexpComp-21.6 {regexp command compiling tests} {
768 regexp -n foo dogfoOd
771 test regexpComp-21.7 {regexp command compiling tests} {
773 regexp -no -- FoO dogfood
776 test regexpComp-21.8 {regexp command compiling tests} {
781 test regexpComp-21.9 {regexp command compiling tests} {
783 list [catch {regexp -- -nocase foo dogfod} msg] $msg
786 test regexpComp-21.10 {regexp command compiling tests} {
788 list [regsub -all "" foo bar str] $str
791 # This useless expression fails. Jim returns "bar"
792 #test regexpComp-21.11 {regexp command compiling tests} {
794 # list [regsub -all "" "" bar str] $str
798 # We can forgive the underlying regexp engine for not supporting this.
799 # Why not use this instead? "((^X)*|\$)"
800 #test regexpComp-22.0.1 {Bug 1810038} {
807 foreach {str exp result} {
822 test regexpComp-22.[incr i] {regexp command compiling tests} \
823 [subst {evalInProc {set a "$str"; regexp {$exp} \$a}}] $result
827 foreach {str exp result} {
842 test regexpComp-23.[incr i] {regexp command compiling tests INST_REGEXP} \
843 [list regexp $exp $str] $result
846 test regexpComp-24.1 {regexp command compiling tests} {
849 regexp -nocase $re bar
852 test regexpComp-24.2 {regexp command compiling tests} {
858 test regexpComp-24.3 {regexp command compiling tests} {
865 test regexpComp-24.4 {regexp command compiling tests} {
871 test regexpComp-24.5 {regexp command compiling tests} {
874 regexp -nocase $re dogfod
877 test regexpComp-24.6 {regexp command compiling tests} {
880 regexp -n $re dogfoOd
883 test regexpComp-24.7 {regexp command compiling tests} {
886 regexp -no -- $re dogfood
889 test regexpComp-24.8 {regexp command compiling tests} {
895 test regexpComp-24.9 {regexp command compiling tests} {
898 list [catch {regexp -- $re dogfod} msg] $msg
900 } {1 {couldn't compile regular expression pattern: parentheses () not balanced}}
901 test regexpComp-24.10 {regexp command compiling tests} {
902 # Bug 1902436 - last * escaped
904 set text {this is *bold* !}
909 test regexpComp-24.11 {regexp command compiling tests} {
910 # Bug 1902436 - last * escaped
912 set text {this is *bold* !}
918 test regexp-25.1 {Repeat on escaped char} {
919 regexp {\x41\x42*} bc
922 test regexp-25.2 {Single braced count} {