Skip to content

Commit 1506fe0

Browse files
authored
Update regexes.pod6
Note that wildcard C<.> now match "\n". Rewrite comments in regexes to make it practical
1 parent 7c39640 commit 1506fe0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

doc/Language/regexes.pod6

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ instead.
3131
Whitespace in regexes is generally ignored (except with the C<:s> or,
3232
completely, C<:sigspace> adverb).
3333
34-
As with Perl 6, in general, comments in regexes start with a hash character
35-
C<#> and go to the end of the line.
34+
As with Perl 6, comments work as usual in regexes.
35+
36+
/ word #`(match lexical "word") /
3637
3738
=head1 Literals
3839
@@ -84,6 +85,20 @@ This doesn't match:
8485
8586
because there's no character to match before C<per> in the target string.
8687
88+
Note that C<.> now does match B<any> single character, that is, it matches
89+
C<\n>. So the text below match:
90+
91+
my $text = qq:to/END/
92+
Although I am a
93+
multi-line text,
94+
now can be matched
95+
with /.*/.
96+
END
97+
;
98+
99+
say $text ~~ / .* /;
100+
# OUTPUT «「Although I am a␤multi-line text,␤now can be matched␤with /.*/␤」»
101+
87102
=head2 Backslashed, predefined character classes
88103
89104
There are predefined character classes of the form C<\w>. Its negation is

0 commit comments

Comments
 (0)