Skip to content

Commit 37d0e2a

Browse files
committed
Test regexp optimizations for substrings
1 parent be966e2 commit 37d0e2a

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

t/re/opt.t

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,40 @@ while (<DATA>) {
231231
}
232232
done_testing();
233233
__END__
234-
0 - -
235-
abc 3 +abc - isall
236-
(?=abc) 0 - - Tminlen=3,minlenret=0
234+
(?:) 0 - - Tisall
235+
236+
# various forms of anchored substring
237+
abc 3 0+abc - isall
238+
.{10}abc 13 10+abc - -
239+
(?i:)abc 3 0+abc - isall
240+
a(?:)bc 3 0+abc - isall
241+
a()bc 3 0+abc - -
242+
a(?i:)bc 3 0+abc - isall
243+
a(b)c 3 0+abc - -
244+
a((?i:b))c 3 0+abc - Tanchored
245+
a[bB]c 3 0+abc - Tanchored
246+
(?=abc) 0 0+abc - Tanchored,Tminlen=3,minlenret=0
247+
abc|abc 3 0+abc - isall
248+
abcd|abce 4 0+abc - -
249+
acde|bcde 4 1+cde - Tanchored,stclass=~[ab]
250+
acdef|bcdeg 5 1+cde - Tanchored,stclass=~[ab]
251+
252+
# same as above, floating
253+
.?abc 3 - 0:1+abc -
254+
.?.{10}abc 13 - 10:11+abc -
255+
.?(?i:)abc 3 - 0:1+abc -
256+
.?a(?:)bc 3 - 0:1+abc -
257+
.?a()bc 3 - 0:1+abc -
258+
.?a(?i:)bc 3 - 0:1+abc -
259+
.?a(b)c 3 - 0+abc -
260+
.?a((?i:b))c 3 - 0+abc Tfloating
261+
.?a[bB]c 3 - 0:1+abc Tfloating
262+
.?(?=abc) 0 - 0:1+abc Tfloating,Tminlen=3,minlenret=0
263+
.?(?:abc|abc) 3 - 0:1+abc -
264+
.?(?:abcd|abce) 4 - 0:1+abc -
265+
.?(?:acde|bcde) 4 - 1:2+cde Tfloating
266+
.?(?:acdef|bcdeg) 5 - 1:2+cde Tfloating
267+
237268
a(b){2,3}c 4 -abb 1+bbc
238-
a(b|bb)c 3 -ab 1+bc Tfloating,Tfloating min offset,Tchecking
239-
a(b|bb){2}c 4 -abb 1+bbc Tanchored,Tfloating,Tfloating min offset
269+
a(b|bb)c 3 -ab 1-bc Tfloating,Tfloating min offset
270+
a(b|bb){2}c 4 -abb 1-bbc Tanchored,Tfloating,Tfloating min offset

0 commit comments

Comments
 (0)