summaryrefslogtreecommitdiff
path: root/t/re
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2020-11-14 12:42:31 +0000
committerKarl Williamson <khw@cpan.org>2020-12-23 21:10:57 -0700
commit36ff5b942287220554d8420d38416c4a7b06c17d (patch)
treed939e1171b007eef9c5821279cc0bfd7e87d7735 /t/re
parente1b0ee053aef77aaae7ebd435aaece3cdfd08e6c (diff)
downloadperl-36ff5b942287220554d8420d38416c4a7b06c17d.tar.gz
Test regexp optimizations for substrings
Diffstat (limited to 't/re')
-rw-r--r--t/re/opt.t41
1 files changed, 36 insertions, 5 deletions
diff --git a/t/re/opt.t b/t/re/opt.t
index 24a3dc0e67..802fdcaaad 100644
--- a/t/re/opt.t
+++ b/t/re/opt.t
@@ -231,9 +231,40 @@ while (<DATA>) {
}
done_testing();
__END__
- 0 - -
-abc 3 +abc - isall
-(?=abc) 0 - - Tminlen=3,minlenret=0
+(?:) 0 - - Tisall
+
+# various forms of anchored substring
+abc 3 0+abc - isall
+.{10}abc 13 10+abc - -
+(?i:)abc 3 0+abc - isall
+a(?:)bc 3 0+abc - isall
+a()bc 3 0+abc - -
+a(?i:)bc 3 0+abc - isall
+a(b)c 3 0+abc - -
+a((?i:b))c 3 0+abc - Tanchored
+a[bB]c 3 0+abc - Tanchored
+(?=abc) 0 0+abc - Tanchored,Tminlen=3,minlenret=0
+abc|abc 3 0+abc - isall
+abcd|abce 4 0+abc - -
+acde|bcde 4 1+cde - Tanchored,stclass=~[ab]
+acdef|bcdeg 5 1+cde - Tanchored,stclass=~[ab]
+
+# same as above, floating
+.?abc 3 - 0:1+abc -
+.?.{10}abc 13 - 10:11+abc -
+.?(?i:)abc 3 - 0:1+abc -
+.?a(?:)bc 3 - 0:1+abc -
+.?a()bc 3 - 0:1+abc -
+.?a(?i:)bc 3 - 0:1+abc -
+.?a(b)c 3 - 0+abc -
+.?a((?i:b))c 3 - 0+abc Tfloating
+.?a[bB]c 3 - 0:1+abc Tfloating
+.?(?=abc) 0 - 0:1+abc Tfloating,Tminlen=3,minlenret=0
+.?(?:abc|abc) 3 - 0:1+abc -
+.?(?:abcd|abce) 4 - 0:1+abc -
+.?(?:acde|bcde) 4 - 1:2+cde Tfloating
+.?(?:acdef|bcdeg) 5 - 1:2+cde Tfloating
+
a(b){2,3}c 4 -abb 1+bbc
-a(b|bb)c 3 -ab 1+bc Tfloating,Tfloating min offset,Tchecking
-a(b|bb){2}c 4 -abb 1+bbc Tanchored,Tfloating,Tfloating min offset
+a(b|bb)c 3 -ab 1-bc Tfloating,Tfloating min offset
+a(b|bb){2}c 4 -abb 1-bbc Tanchored,Tfloating,Tfloating min offset