Skip to content

Commit 3206fec

Browse files
committed
Adds info on escaping characters closes #1146
1 parent 09b2310 commit 3206fec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/Language/regexes.pod6

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ write the backslashed forms for character classes between the C<[ ]>.
351351
/ <[02468]> /;
352352
# because the first one also contains "weird" unicodey digits
353353
354+
You can use C<\> to escape characters that would have some meaning in the regular expression:
355+
356+
say "[- hey -]" ~~ /<-[ \- \] [ \s ]>+/; # OUTPUT: «「hey」␤»
357+
354358
To negate a character class, put a C<-> after the opening angle:
355359
356360
say 'no quotes' ~~ / <-[ " ]> + /; # matches characters except "

0 commit comments

Comments
 (0)