3 # This is a home for regular expression tests that don't fit into
4 # the format supported by op/regexp.t. If you want to add a test
5 # that does fit that format, add it to op/re_tests, not here.
13 eval 'use Config'; # Defaults assumed if this fails
15 # XXX known to leak scalars
16 $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
20 if ($x =~ /^abc/) {print "ok 1\n";} else {print "not ok 1\n";}
21 if ($x !~ /^def/) {print "ok 2\n";} else {print "not ok 2\n";}
24 if ($x =~ /^def/) {print "ok 3\n";} else {print "not ok 3\n";}
28 if (/^([0-9][0-9]*)/) {print "ok 4\n";} else {print "not ok 4\n";}
30 if ($x =~ /^xxx/) {print "not ok 5\n";} else {print "ok 5\n";}
31 if ($x !~ /^abc/) {print "not ok 6\n";} else {print "ok 6\n";}
33 if ($x =~ /def/) {print "ok 7\n";} else {print "not ok 7\n";}
34 if ($x !~ /def/) {print "not ok 8\n";} else {print "ok 8\n";}
36 if ($x !~ /.def/) {print "ok 9\n";} else {print "not ok 9\n";}
37 if ($x =~ /.def/) {print "not ok 10\n";} else {print "ok 10\n";}
39 if ($x =~ /\ndef/) {print "ok 11\n";} else {print "not ok 11\n";}
40 if ($x !~ /\ndef/) {print "not ok 12\n";} else {print "ok 12\n";}
43 if (/(a*b*)(c*)/ && $1 eq 'aaabbb' && $2 eq 'ccc') {
48 if (/(a+b+c+)/ && $1 eq 'aaabbbccc') {
54 if (/a+b?c+/) {print "not ok 15\n";} else {print "ok 15\n";}
57 if (/a+b?c+/) {print "ok 16\n";} else {print "not ok 16\n";}
58 if (/a*b+c*/) {print "ok 17\n";} else {print "not ok 17\n";}
61 if (/a*b?c*/) {print "ok 18\n";} else {print "not ok 18\n";}
62 if (/a*b+c*/) {print "not ok 19\n";} else {print "ok 19\n";}
65 if (/bcd|xyz/) {print "ok 20\n";} else {print "not ok 20\n";}
66 if (/xyz|bcd/) {print "ok 21\n";} else {print "not ok 21\n";}
68 if (m|bc/*d|) {print "ok 22\n";} else {print "not ok 22\n";}
70 if (/^$_$/) {print "ok 23\n";} else {print "not ok 23\n";}
72 $* = 1; # test 3 only tested the optimized version--this one is for real
73 if ("ab\ncd\n" =~ /^cd/) {print "ok 24\n";} else {print "not ok 24\n";}
80 @XXX = ('ok 25','not ok 25', 'ok 26','not ok 26','not ok 27');
81 while ($_ = shift(@XXX)) {
82 ?(.*)? && (print $1,"\n");
84 /not ok 26/ && reset 'X';
87 while (($key,$val) = each(%XXX)) {
96 if ($& eq 'xyz') {print "ok 28\n";} else {print "not ok 28\n";}
101 if ($& eq 'xyz') {print "ok 29\n";} else {print "not ok 29\n";}
106 if ($& eq 'xyz') {print "ok 30\n";} else {print "not ok 30\n";}
109 /def/; # optimized up to cmd
110 if ("$`:$&:$'" eq 'abc:def:ghi') {print "ok 31\n";} else {print "not ok 31\n";}
112 /cde/ + 0; # optimized only to spat
113 if ("$`:$&:$'" eq 'ab:cde:fghi') {print "ok 32\n";} else {print "not ok 32\n";}
115 /[d][e][f]/; # not optimized
116 if ("$`:$&:$'" eq 'abc:def:ghi') {print "ok 33\n";} else {print "not ok 33\n";}
118 $_ = 'now is the {time for all} good men to come to.';
120 if ($1 eq 'time for all') {print "ok 34\n";} else {print "not ok 34 $1\n";}
122 $_ = 'xxx {3,4} yyy zzz';
123 print /( {3,4})/ ? "ok 35\n" : "not ok 35\n";
124 print $1 eq ' ' ? "ok 36\n" : "not ok 36\n";
125 print /( {4,})/ ? "not ok 37\n" : "ok 37\n";
126 print /( {2,3}.)/ ? "ok 38\n" : "not ok 38\n";
127 print $1 eq ' y' ? "ok 39\n" : "not ok 39\n";
128 print /(y{2,3}.)/ ? "ok 40\n" : "not ok 40\n";
129 print $1 eq 'yyy ' ? "ok 41\n" : "not ok 41\n";
130 print /x {3,4}/ ? "not ok 42\n" : "ok 42\n";
131 print /^xxx {3,4}/ ? "not ok 43\n" : "ok 43\n";
133 $_ = "now is the time for all good men to come to.";
135 print join(':',@words) eq "now:is:the:time:for:all:good:men:to:come:to"
143 print join(':',@words) eq "now:is:the:time:for:all:good:men:to:come:to"
152 print join(':',@words) eq "to:to"
154 : "not ok 46 `@words'\n";
158 print join(':',@words) eq "to:to"
160 : "not ok 47 `@words'\n";
174 $t1=$t2=$t3=$t4=$t5=$t6=$t7=$t8=$t9=0;
188 $x = "$t1$t2$t3$t4$t5$t6$t7$t8$t9";
189 print $x eq '505550555' ? "ok 48\n" : "not ok 48 $x\n";
192 print "abc" =~ /^abc$|$xyz/ ? "ok 49\n" : "not ok 49\n";
194 # perl 4.009 says "unmatched ()"
195 eval '"abc" =~ /a(bc$)|$xyz/; $result = "$&:$1"';
196 print $@ eq "" ? "ok 50\n" : "not ok 50\n";
197 print $result eq "abc:bc" ? "ok 51\n" : "not ok 51\n";
202 print $` eq "" ? "ok 52\n" : "not ok 52\n" if $x;
204 print $` eq "abcfoo" ? "ok 53\n" : "not ok 53\n" if $x;
206 print $x == 0 ? "ok 54\n" : "not ok 54\n";
209 print $` eq "" ? "ok 55\n" : "not ok 55\n" if $x;
211 print $` eq "abcfoo" ? "ok 56\n" : "not ok 56\n" if $x;
213 print $x == 0 ? "ok 57\n" : "not ok 57\n";
216 print $' eq "fooabcbar" ? "ok 58\n" : "not ok 58\n" if $x;
218 print $' eq "bar" ? "ok 59\n" : "not ok 59\n" if $x;
221 print scalar @x == 2 ? "ok 60\n" : "not ok 60\n";
226 print "not " if (pos $_) != 2;
229 print "not " if defined pos $_;
233 'abc' =~ m'a(?{ $out = 2 })b';
234 print "not " if $out != 2;
238 'abc' =~ m'a(?{ $out = 3 })c';
239 print "not " if $out != 1;
242 $_ = 'foobar1 bar2 foobar3 barfoobar5 foobar6';
243 @out = /(?<!foo)bar./g;
244 print "not " if "@out" ne 'bar2 barf';
247 # Tests which depend on REG_INFTY
248 $reg_infty = defined $Config{reg_infty} ? $Config{reg_infty} : 32767;
249 $reg_infty_m = $reg_infty - 1; $reg_infty_p = $reg_infty + 1;
251 # As well as failing if the pattern matches do unexpected things, the
252 # next three tests will fail if you should have picked up a lower-than-
253 # default value for $reg_infty from Config.pm, but have not.
256 print "not " if eval q(('aaa' =~ /(a{1,$reg_infty_m})/)[0] ne 'aaa') || $@;
260 print "not " if eval q(('a' x $reg_infty_m) !~ /a{$reg_infty_m}/) || $@;
264 print "not " if eval q(('a' x ($reg_infty_m - 1)) =~ /a{$reg_infty_m}/) || $@;
268 eval "'aaa' =~ /a{1,$reg_infty}/";
269 print "not " if $@ !~ m%^\QQuantifier in {,} bigger than%;
272 eval "'aaa' =~ /a{1,$reg_infty_p}/";
274 if $@ !~ m%^\QQuantifier in {,} bigger than%;
278 # Poke a couple more parse failures
280 $context = 'x' x 256;
281 eval qq("${context}y" =~ /(?<=$context)y/);
282 print "not " if $@ !~ m%^\QLookbehind longer than 255 not%;
290 for $l (125, 140, 250, 270, 300000, 30) { # Ordered to free memory
292 print "# length=$l\nnot " unless "ba$a=" =~ /a$a=/;
296 print "not " if "b$a=" =~ /a$a=/;
301 # 20000 nodes, each taking 3 words per string, and 1 per branch
302 $long_constant_len = join '|', 12120 .. 32645;
303 $long_var_len = join '|', 8120 .. 28645;
304 %ans = ( 'ax13876y25677lbc' => 1,
305 'ax13876y25677mcb' => 0, # not b.
306 'ax13876y35677nbc' => 0, # Num too big
307 'ax13876y25677y21378obc' => 1,
308 'ax13876y25677y21378zbc' => 0, # Not followed by [k-o]
309 'ax13876y25677y21378y21378kbc' => 1,
310 'ax13876y25677y21378y21378kcb' => 0, # Not b.
311 'ax13876y25677y21378y21378y21378kbc' => 0, # 5 runs
315 print "# const-len `$_' not => $ans{$_}\nnot "
316 if $ans{$_} xor /a(?=([yx]($long_constant_len)){2,4}[k-o]).*b./o;
319 print "# var-len `$_' not => $ans{$_}\nnot "
320 if $ans{$_} xor /a(?=([yx]($long_var_len)){2,4}[k-o]).*b./o;
325 $_ = " a (bla()) and x(y b((l)u((e))) and b(l(e)e)e";
326 $expect = "(bla()) ((l)u((e))) (l(e)e)";
332 (?{ $c = 1 }) # Initialize
334 (?(?{ $c == 0 }) # PREVIOUS iteration was OK, stop the loop
336 ) # Fail: will unwind one iteration back
339 [^()]+ # Match a big chunk
342 ) # Do not try to match subchunks
350 )+ # This may not match with different subblocks
355 ) # Otherwise the chunk 1 may succeed with $c>0
360 push @ans, $res while $res = matchit;
362 print "# ans='@ans'\n# expect='$expect'\nnot " if "@ans" ne "1 1 1";
368 print "# ans='@ans'\n# expect='$expect'\nnot " if "@ans" ne $expect;
372 print "not " unless "abc" =~ /^(??{"a"})b/;
377 $matched = qr/\((?:(?>[^()]+)|(??{$matched}))*\)/;
380 push(@ans, $res), push(@ans1, $&) while $res = m/$matched/g;
382 print "# ans='@ans'\n# expect='$expect'\nnot " if "@ans" ne "1 1 1";
386 print "# ans1='@ans1'\n# expect='$expect'\nnot " if "@ans1" ne $expect;
392 print "# ans='@ans'\n# expect='$expect'\nnot " if "@ans" ne $expect;
396 @ans = ('a/b' =~ m%(.*/)?(.*)%); # Stack may be bad
397 print "not " if "@ans" ne 'a/ b';
401 $code = '{$blah = 45}';
404 print "not " unless $@ and $@ =~ /not allowed at runtime/ and $blah == 12;
408 for $code ('{$blah = 45}','=xx') {
410 $res = eval { "xx" =~ /(?$code)/o };
411 if ($code eq '=xx') {
412 print "#'$@','$res','$blah'\nnot " unless not $@ and $res;
414 print "#'$@','$res','$blah'\nnot " unless $@ and $@ =~ /not allowed at runtime/ and $blah == 12;
420 $code = '{$blah = 45}';
423 print "not " if $blah != 45;
429 print "not " if $blah != 45;
435 print "not " unless pos($x) == 2;
440 print "not " unless pos($x) == 2;
450 print "not " unless f(pos($x)) == 4;
455 'foot' =~ /foo(?{$x = 12; 75})[t]/;
456 print "not " unless $^R eq '75';
461 'foot' =~ /foo(?{$x = 12; 75})[xy]/;
462 print "not " unless $^R eq '67' and $x eq '12';
467 'foot' =~ /foo(?{ $^R + 12 })((?{ $x = 12; $^R + 17 })[xy])?/;
468 print "not " unless $^R eq '79' and $x eq '12';
472 print "not " unless qr/\b\v$/i eq '(?i-xsm:\bv$)';
476 print "not " unless qr/\b\v$/s eq '(?s-xim:\bv$)';
480 print "not " unless qr/\b\v$/m eq '(?m-xis:\bv$)';
484 print "not " unless qr/\b\v$/x eq '(?x-ism:\bv$)';
488 print "not " unless qr/\b\v$/xism eq '(?msix:\bv$)';
492 print "not " unless qr/\b\v$/ eq '(?-xism:\bv$)';
497 foreach $ans ('', 'c') {
498 /(?<=(?=a)..)((?=c)|.)/g;
499 print "# \$1 ='$1'\n# \$ans='$ans'\nnot " unless $1 eq $ans;
505 foreach $ans ('', 'a', '') {
507 print "# \$& ='$&'\n# \$ans='$ans'\nnot " unless $& eq $ans;
513 my($v,$a,$b,$res) = @_;
515 print "not " unless $res eq $v;
519 prefixify('/a/b/lib/arch', "/a/b/lib", 'X/lib', 'X/lib/arch');
520 prefixify('/a/b/man/arch', "/a/b/man", 'X/man', 'X/man/arch');
524 print "not " unless $1 and /$1/;
531 print "not " unless $b eq '9';
537 print "not " unless $b eq '11';
544 print "not " unless $b eq '14';
552 my $lex_res = ($lex_b =~ qr/$lex_b(?{ $lex_c = $lex_a++ })/);
553 print "not " unless $lex_res eq '1';
556 print "not " unless $lex_a eq '44';
559 print "not " unless $lex_c eq '43';
565 $match = eval { /$a$c$a/ };
567 unless $b eq '14' and $@ =~ /Eval-group not allowed/ and not $match;
577 my $lex_res = ($lex_b =~ qr/17(?{ $lex_c = $lex_a++ })/);
578 print "not " unless $lex_res eq '1';
581 print "not " unless $lex_a eq '44';
584 print "not " unless $lex_c eq '43';
593 '' =~ /(?{ $c = 4 })/;
594 print "not " unless $c == 4;
598 print "not " unless $c == 3;
603 my $warn_pat = shift;
604 return sub { print "not " unless $_[0] =~ /$warn_pat/ }
608 my ($warn_pat, $code) = @_;
610 eval 'BEGIN { use warnings; $SIG{__WARN__} = $warn_pat };' . $code;
617 my $warn_pat = shift;
618 return sub { must_warn(must_warn_pat($warn_pat)) }
621 my $for_future = make_must_warn('reserved for future extensions');
623 &$for_future('q(a:[b]:) =~ /[x[:foo:]]/');
625 #&$for_future('q(a=[b]=) =~ /[x[=foo=]]/');
626 print "ok $test\n"; $test++; # now a fatal croak
628 #&$for_future('q(a.[b].) =~ /[x[.foo.]]/');
629 print "ok $test\n"; $test++; # now a fatal croak
631 # test if failure of patterns returns empty list
654 print "not " if $#+ != 0 or $#- != 0;
658 print "not " if $+[0] != 2 or $-[0] != 1;
663 if defined $+[1] or defined $-[1] or defined $+[2] or defined $-[2];
668 print "not " if $#+ != 2 or $#- != 2;
672 print "not " if $+[0] != 3 or $-[0] != 0;
676 print "not " if $+[1] != 2 or $-[1] != 1;
680 print "not " if $+[2] != 3 or $-[2] != 2;
685 if defined $+[3] or defined $-[3] or defined $+[4] or defined $-[4];
690 print "not " if $#+ != 3 or $#- != 3;
694 print "not " if $+[0] != 3 or $-[0] != 0;
698 print "not " if $+[1] != 2 or $-[1] != 1;
702 print "not " if $+[3] != 3 or $-[3] != 2;
707 if defined $+[2] or defined $-[2] or defined $+[4] or defined $-[4];
712 print "not " if $#+ != 1 or $#- != 1;
716 print "not " if $+[0] != 2 or $-[0] != 0;
720 print "not " if $+[1] != 2 or $-[1] != 1;
725 if defined $+[2] or defined $-[2] or defined $+[3] or defined $-[3];
729 eval { $+[0] = 13; };
731 if $@ !~ /^Modification of a read-only value attempted/;
735 eval { $-[0] = 13; };
737 if $@ !~ /^Modification of a read-only value attempted/;
741 eval { @+ = (7, 6, 5); };
743 if $@ !~ /^Modification of a read-only value attempted/;
747 eval { @- = qw(foo bar); };
749 if $@ !~ /^Modification of a read-only value attempted/;
754 print "#$#-..$#+\nnot " if $#+ != 2 or $#- != 1;
761 print "not " unless "@a" eq "a a";
768 print "not " if $str =~ /^\G/;
772 print "not " if $str =~ /^.\G/;
776 print "not " unless $str =~ /^..\G/;
780 print "not " if $str =~ /^...\G/;
784 print "not " unless $str =~ /.\G./ and $& eq 'bc';
788 print "not " unless $str =~ /\G../ and $& eq 'cd';
792 undef $foo; undef $bar;
793 print "#'$str','$foo','$bar'\nnot "
794 unless $str =~ /b(?{$foo = $_; $bar = pos})c/
795 and $foo eq 'abcde' and $bar eq 2;
799 undef $foo; undef $bar;
801 print "#'$str','$foo','$bar'\nnot "
802 unless $str =~ /b(?{$foo = $_; $bar = pos})c/g
803 and $foo eq 'abcde' and $bar eq 2 and pos $str eq 3;
809 undef $foo; undef $bar;
810 print "#'$str','$foo','$bar'\nnot "
811 unless /b(?{$foo = $_; $bar = pos})c/
812 and $foo eq 'abcde' and $bar eq 2;
816 undef $foo; undef $bar;
817 print "#'$str','$foo','$bar'\nnot "
818 unless /b(?{$foo = $_; $bar = pos})c/g
819 and $foo eq 'abcde' and $bar eq 2 and pos eq 3;
823 undef $foo; undef $bar;
825 1 while /b(?{$foo = $_; $bar = pos})c/g;
826 print "#'$str','$foo','$bar'\nnot "
827 unless $foo eq 'abcde' and $bar eq 2 and not defined pos;
831 undef $foo; undef $bar;
833 print "#'$str','$foo','$bar','$_'\nnot "
834 unless s/b(?{$foo = $_; $bar = pos})c/x/g and $foo eq 'abcde|abcde'
835 and $bar eq 8 and $_ eq 'axde|axde';
842 @dummy = /([ace]).(?{push @res, $1,$2})([ce])(?{push @res, $1,$2})/g;
843 @res = map {defined $_ ? "'$_'" : 'undef'} @res;
845 print "#'@res' '$_'\nnot "
846 unless "@res" eq "'a' undef 'a' 'c' 'e' undef 'a' undef 'a' 'c'";
851 @dummy = /([ace]).(?{push @res, $`,$&,$'})([ce])(?{push @res, $`,$&,$'})/g;
852 @res = map {defined $_ ? "'$_'" : 'undef'} @res;
854 print "#'@res' '$_'\nnot "
856 "'' 'ab' 'cde|abcde' " .
857 "'' 'abc' 'de|abcde' " .
858 "'abcd' 'e|' 'abcde' " .
859 "'abcde|' 'ab' 'cde' " .
860 "'abcde|' 'abc' 'de'" ;
864 #Some more \G anchor checks
865 $foo='aabbccddeeffgg';
870 print "not " unless($1 eq 'ab');
876 print "not " unless($1 eq 'cc');
882 print "not " unless($1 eq 'de');
886 print "not " unless $foo =~ /\Gef/g;
893 print "not " unless($1 eq 'aa');
898 print "not " unless($1 eq 'bb');
904 print "not " unless($1 eq 'cd');
910 print "not " unless('123||x|123|' eq join '|', @res);
914 # see if matching against temporaries (created via pp_helem()) is safe
915 { foo => "ok $test\n".$^X }->{foo} =~ /^(.*)\n/g;
919 # See if $i work inside (?{}) in the presense of saved substrings and
923 s/(\w)(?{push @b, $1})/,$1,/g for @a;
925 print "# \@b='@b', expect 'f o o b a r'\nnot " unless("@b" eq "f o o b a r");
929 print "not " unless("@a" eq ",f,,o,,o, ,b,,a,,r,");
934 { (?> [^{}]+ | (??{ $brackets }) )* }
938 print "ok $test\n"; # Did we survive?
941 "something { long { and } hairy" =~ $brackets;
942 print "ok $test\n"; # Did we survive?
945 "something { long { and } hairy" =~ m/((??{ $brackets }))/;
946 print "not " unless $1 eq "{ and }";
952 m/^-.*bb/mg and print "not ";
958 $text =~ /\GXb*X/g and print 'not ';
962 $text = "xA\n" x 500;
963 $text =~ /^\s*A/m and print 'not ';
968 @res = ($text =~ /.*?(b).*?\b/g);
969 "@res" eq 'b b' or print 'not ';
976 @c = grep(/[^\s]/,@a);
977 print "not " if "@b" ne "@c";
982 @c = grep(/[\S]/,@a);
983 print "not " if "@b" ne "@c";
988 @c = grep(/[^\S]/,@a);
989 print "not " if "@b" ne "@c";
994 @c = grep(/[\s]/,@a);
995 print "not " if "@b" ne "@c";
1000 @c = grep(/[^\d]/,@a);
1001 print "not " if "@b" ne "@c";
1006 @c = grep(/[\D]/,@a);
1007 print "not " if "@b" ne "@c";
1012 @c = grep(/[^\D]/,@a);
1013 print "not " if "@b" ne "@c";
1018 @c = grep(/[\d]/,@a);
1019 print "not " if "@b" ne "@c";
1024 @c = grep(/[^\w]/,@a);
1025 print "not " if "@b" ne "@c";
1030 @c = grep(/[\W]/,@a);
1031 print "not " if "@b" ne "@c";
1036 @c = grep(/[^\W]/,@a);
1037 print "not " if "@b" ne "@c";
1042 @c = grep(/[\w]/,@a);
1043 print "not " if "@b" ne "@c";
1047 # see if backtracking optimization works correctly
1048 "\n\n" =~ /\n $ \n/x or print "not ";
1052 "\n\n" =~ /\n* $ \n/x or print "not ";
1056 "\n\n" =~ /\n+ $ \n/x or print "not ";
1060 [] =~ /^ARRAY/ or print "# [] \nnot ";
1067 use overload '""' => sub { 'Object S' };
1068 sub new { bless [] }
1073 $a and $a =~ /^Object\sS/ or print "# '$a' \nnot ";
1077 # test result of match used as match (!)
1078 'a1b' =~ ('xyz' =~ /y/) and $` eq 'a' or print "not ";
1082 'a1b' =~ ('xyz' =~ /t/) and $` eq 'a' or print "not ";
1088 local $SIG{__WARN__} = sub { $w = 1 };
1090 $w = 1 if ("1\n" x 102) =~ /^\s*\n/m;
1092 print $w ? "not " : "", "ok $test\n";
1095 my %space = ( spc => " ",
1100 # There's no \v but the vertical tabulator seems miraculously
1101 # be 11 both in ASCII and EBCDIC.
1105 my @space0 = sort grep { $space{$_} =~ /\s/ } keys %space;
1106 my @space1 = sort grep { $space{$_} =~ /[[:space:]]/ } keys %space;
1107 my @space2 = sort grep { $space{$_} =~ /[[:blank:]]/ } keys %space;
1109 print "not " unless "@space0" eq "cr ff lf spc tab";
1110 print "ok $test # @space0\n";
1113 print "not " unless "@space1" eq "cr ff lf spc tab vt";
1114 print "ok $test # @space1\n";
1117 print "not " unless "@space2" eq "spc tab";
1118 print "ok $test # @space2\n";
1121 # bugid 20001021.005 - this caused a SEGV
1122 print "not " unless undef =~ /^([^\/]*)(.*)$/;
1126 # bugid 20000731.001
1128 print "not " unless "A \x{263a} B z C" =~ /A . B (??{ "z" }) C/;
1133 if (/(.)(\C)(\C)(.)/) {
1138 print "not ok 233\n";
1143 print "not ok 234\n";
1148 print "not ok 235\n";
1153 print "not ok 236\n";
1157 print "not ok $_\n";
1166 print "not ok 238\n";
1170 print "not ok $_\n";
1178 print "not ok 240\n";
1182 print "not ok $_\n";
1188 # The tr is admittedly NOT a regular expression operator,
1189 # but this test is more of an EBCDIC test, the background is
1190 # that \x89 is 'i' and \x90 is 'j', and \x8e is not a letter,
1191 # not even a printable character. Now for the trick:
1192 # if the range is specified using letters, the \x8e should most
1193 # probably not match, but if the range is specified using explicit
1194 # numeric endpoints, it probably should match. The first case,
1195 # not matching if using letters, is already tested elsewhere,
1196 # here we test for the matching cases.
1200 print "not " unless /[\x89-\x91]/;
1203 print "not " unless tr/\x89-\x91//d == 1;