On Tue, 7 May 2019 at 13:10, ToddAndMargo via perl6-users
<perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
Hi All,
What am I doing wrong here?
$ p6 'my $x="\$1.23"; $x~~s/("\$") (.*?)/$1USD/; say $x;'
USD1.23
I am expecting to see `1.23USD`
Many thanks,
-T
On 5/6/19 8:24 PM, Norman Gaywood wrote:
The .*? expression is not matching anything. I think you want to use .+
perl6 -e 'my $x="\$1.23"; $x~~s/("\$") (.*?)/$0:$1:USD/; say $x;'
$::USD1.23
perl6 -e 'my $x="\$1.23"; $x~~s/ \$(.+) /$0USD/; say $x'
1.23USD
Hi Normin,
That was it. I wasn't greedy enough.
Removing the ?
$ p6 'my $x="\$1.23"; $x~~s/("\$") (.*)/$1 USD/; say $x;'
1.23 USD
Thank you!