Skip to content

Commit

Permalink
Adds info on escaping characters closes #1146
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed May 13, 2018
1 parent 09b2310 commit 3206fec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/Language/regexes.pod6
Expand Up @@ -351,6 +351,10 @@ write the backslashed forms for character classes between the C<[ ]>.
/ <[02468]> /;
# because the first one also contains "weird" unicodey digits
You can use C<\> to escape characters that would have some meaning in the regular expression:
say "[- hey -]" ~~ /<-[ \- \] [ \s ]>+/; # OUTPUT: «「hey」␤»
To negate a character class, put a C<-> after the opening angle:
say 'no quotes' ~~ / <-[ " ]> + /; # matches characters except "
Expand Down

0 comments on commit 3206fec

Please sign in to comment.