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

Re: need second pair of eyes

Thread Previous | Thread Next
From:
ToddAndMargo
Date:
June 13, 2018 01:09
Subject:
Re: need second pair of eyes
Message ID:
0e97726e-e7ff-b121-6015-a0a5c2c5e9b0@zoho.com
On 06/12/2018 05:47 PM, Timo Paulssen wrote:
> My recommendations:
> 
>      if $line.contains(all("wine-patched/archive/staging-/", ".tar.gz")){ }
> 
>      # if the path has to be at the beginning and the extension at the end,
>      # which your original regex doesn't require, but it's probably right
>      if $line.starts-with("wine-patched/archive/staging-/") &&
> $line.ends-with(".tar.gz") { }
> 
>      if $line ~~ m{ "wine-patched/archive/staging-/" .* ".tar.gz" } { }
> 
> What do you think?
>    - Timo
> 

I like it.

I used

$ p6 'my $Line = "wine-patched/archive/staging-/xxxxx.tar.gz";if $Line 
~~ m| "wine-patched/archive/staging-/" .*? ".tar.gz" |  {say "yes"} else 
{say "no"};'
yes

as it insures the patterns are in sequence, not random.

Thank you!

Thread Previous | 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