Skip to content

Commit 5b939ec

Browse files
committed
Explicilty mention ^ and $ anchor to string and not line. mspo++
1 parent 7cb83fb commit 5b939ec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Language/regexes.pod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,18 @@ You can, of course, combine both anchors:
442442
say so 'use perl' ~~ /^ perl $/; # False
443443
say so 'perl' ~~ /^ perl $/; # True
444444
445+
Keep in mind, these anchors match end of B<string>, not line:
446+
447+
my $str = q:to/EOS/;
448+
Keep it secret
449+
and keep it safe
450+
EOS
451+
452+
say so $s ~~ /safe $/; # True
453+
say so $s ~~ /secret $/; # False
454+
say so $s ~~ /^Keep /; # True
455+
say so $s ~~ /^and /; # False
456+
445457
=head2 X«C<^^>, Start of Line and C<$$>, End of Line|regex,^^;regex,$$»
446458
447459
The C<^^> assertion matches at the start of a logical line. That is, either

0 commit comments

Comments
 (0)