use v6;
my regex demo ($param) {
    foo             # First match 'foo'
    { say $param }  # Then show the value that was passed in
    bar             # Then match 'bar'
}

'foobar' ~~ / <demo: { key => <v a l> }> /