Hi All,

This works:

$ p6 'my $x="2018-09-15"; $x~~s/ (<:N>+) "-" (<:N>+) "-" (<:N>+) /$0.$1.$2/; say $x;'
2018.09.15


And this does too:

$ perl6 -e 'my Str $Date=DateTime.now.Str; $Date~~m/ (<:N>+) "-" (<:N>+) "-" (<:N>+) "T" .* /; print "$Date\n\t$0 $1 $2\n"'
2019-01-12T14:35:23.242587-08:00
        2019  01  12



But this does not.  What is wrong with (<:N>**2)  ?

$ perl6 -e 'my Str $Date=DateTime.now.Str; $Date~~m/ (<:N>**4) "-" (<:N>**2) "-" (<:Nl>**2) "T" .* /; print "$Date\n\t$0 $1 $2\n"'
Use of Nil in string context
  in block <unit> at -e line 1
Use of Nil in string context
  in block <unit> at -e line 1
Use of Nil in string context
  in block <unit> at -e line 1
2019-01-12T14:33:10.692302-08:00


Many thanks,
-T

Reply via email to