use v6;
use Test;
plan 8;
{
my @matches = "hello world".match(/.o/, :g).list;
is +@matches, 2, "Two matches found";
is ~(@matches[0]), "lo", "First match is 'lo'";
is ~(@matches[1]), "wo", "Second match is 'wo'";
}
{
my @matches = "hello world".match(/foo/, :g).list;
is +@matches, 0, "Zero matches found";
}
{
my @matches = "hello world".match(/<[aeiou]>./, :global).list;
is +@matches, 3, "Three matches found";
is ~(@matches[0]), "el", "First match is 'el'";
is ~(@matches[1]), "o ", "Second match is 'o '";
is ~(@matches[2]), "or", "Third match is 'or'";
}
done_testing;