develooper Front page | perl.perl6.users | Postings from May 2018

need <-[x]> help

Thread Next
From:
Todd Chester
Date:
May 3, 2018 10:11
Subject:
need <-[x]> help
Message ID:
9ba4f757-d1d1-05d0-775e-f8a1573ab16a@zoho.com
Hi All,

What I am trying to do is to replace a quote `"`
with `inches`, but NOT when the quote is followed
by a comma `,`.

In other words, ignore `",`

I am not having too good a time with it.  What am I
doing wrong?

$ perl6 -e 'my $x=qw["44","7" ab","","999"]; say 
"$x";$x~~s:g/\"(.)<-[,]>/ inches($0)/; say "$x";'

"44","7" ab","","999"
inches(4)inches(,)7inches( )binches(,)inches(,)999"

desired output:
"44","7 inches ab","","999"

Many thanks,
-T

next step, ignoring the quote at the end of the line.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About