You want to do two things:

1. match/replace something

2. match/replace something else

To do this in one command you need:

* `:g` to tell P6 to keep going after the first match

* `||` to tell P6 to match what's on the left first, or if that fails,
what's on the right

Which yields:

my $x="    State : abc     "; $x ~~ s:g/.*?" : "||" ".*//; say "<$x>"; # <abc>


On Sat, Sep 23, 2017 at 1:29 AM, ToddAndMargo <toddandma...@zoho.com> wrote:
> Hi All,
>
> Question.  Can I chain these two substitutions together?
>
> $ perl6 -e 'my $x="    State : abc     "; $x ~~ s/.*?" : "//; $x ~~ s/"
> ".*//; say "<$x>";'
>
> <abc>
>
> Many thanks,
> -T



-- 
raiph

Reply via email to