# Modifiers are adverbs at the *start* of a regex. if "TMTOWTDI" ~~ m:ignorecase/ tmtowtdi / { # or for short m:i// say "Matched '$/' while ignoring case"; } if "foo bar" ~~ m:sigspace/ foo bar / { # space is significant now say "Matched '$/' while space is significant"; }
:ignorecase :i => makes matching case insignificant
:ignoremark :m => ignores accents
:sigspace :s => whitspace is significant
:ratchet :r => Causes the regex to not backtrack by default
:global :g =>
:Perl5 :P5 => Runs in Perl 5 regular expression mode
Unicode modifiers
:bytes => Match bytes
:codes => Match codepoints
:graphs => Match language-independent graphemes
:chars => Match at current max level