Making character class with modifier symbols in Perl 6

You could try use ignoremark:

The :ignoremark or :m adverb instructs the regex engine to only compare base characters, and ignore additional marks such as combining accents.

For your example:

my $vowel = /:m<[aeiou]>/;
.say for "áeikj" ~~ m:g/ <$vowel> /;

Output:

「á」
「e」
「i」

The reason you can't match a vowel with a combining character using / <[aeiou]> <:Sk>* / is that strings in Perl 6 are operated on at the grapheme level. At that level, ų̄ is already just a single character, and <[aeiou]> being a character class already matches one whole character.

The right solution is, as Håkon pointed out in the other answer, to use the ignoremark adverb. You can put it before the regex like rx:m/ <[aeiou]> / or inside of it, or even turn it on and off at different points with :m and :!m.

Tags:

Raku