summaryrefslogtreecommitdiff
path: root/t/pragma/warn/regcomp
blob: 6545778a38073d2856335da274dce0170d0545c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  regcomp.c	AOK

  %.*s matches null string many times   

	$a = "ABC123" ; $a =~ /(?=a)*/'

  Strange *+?{} on zero-length expression

	/(?=a)?/

  Character class syntax [. .] is reserved for future extensions
  Character class syntax [= =] is reserved for future extensions

__END__
# regcomp.c
use warning 'unsafe' ;
my $a = "ABC123" ; 
$a =~ /(?=a)*/ ;
no warning 'unsafe' ;
$a =~ /(?=a)*/ ;
EXPECT
(?=a)* matches null string many times at - line 4.
########
# regcomp.c
use warning 'unsafe' ;
$_ = "" ;
/(?=a)?/;
no warning 'unsafe' ;
/(?=a)?/;
EXPECT
Strange *+?{} on zero-length expression at - line 4.
########
# regcomp.c
use warning 'unsafe' ;
$_ = "" ;
/[:alpha:]/;
/[.bar.]/;
/[=zog=]/;
/[[:alpha:]]/;
/[[.foo.]]/;
/[[=bar=]]/;
/[:zog:]/;
no warning 'unsafe' ;
/[:alpha:]/;
/[.foo.]/;
/[=bar=]/;
/[[:alpha:]]/;
/[[.foo.]]/;
/[[=bar=]]/;
/[:zog:]/;
/[[:zog:]]/;
EXPECT
Character class syntax [: :] belongs inside character classes at - line 4.
Character class syntax [. .] belongs inside character classes at - line 5.
Character class syntax [. .] is reserved for future extensions at - line 5.
Character class syntax [= =] belongs inside character classes at - line 6.
Character class syntax [= =] is reserved for future extensions at - line 6.
Character class syntax [. .] is reserved for future extensions at - line 8.
Character class syntax [= =] is reserved for future extensions at - line 9.
Character class syntax [: :] belongs inside character classes at - line 10.
Character class [:zog:] unknown at - line 19.