File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1273,6 +1273,18 @@ Grammars provide an easy way to override what C«<.ws>» matches:
1273
1273
When parsing file formats where some whitespace (for example, vertical
1274
1274
whitespace) is significant, it's advisable to override C < ws > .
1275
1275
1276
+ = head3 Perl 5 compatibility adverb
1277
+
1278
+ The B < C < :Perl5 > > or B < C < :P5 > > adverb switch the Regex parsing and matching
1279
+ back to the way Perl 5 regexes did behave:
1280
+
1281
+ so 'hello world' ~~ m:Perl5/^hello (world)/ # OUTPUT: «True»
1282
+ so 'hello world' ~~ m/^hello (world)/ # OUTPUT: «False»
1283
+ so 'hello world' ~~ m/^ 'hello ' ('world')/ # OUTPUT: «True»
1284
+
1285
+ The regular behavior is recommended and more idiomatic in Perl 6 of course,
1286
+ but the B < C < :Perl5 > > adverb can be useful when backwards-compatibility is required.
1287
+
1276
1288
= head2 Matching adverbs
1277
1289
1278
1290
In contrast to regex adverbs, which are tied to the declaration of a regex,
You can’t perform that action at this time.
0 commit comments