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

Re: need second pair of eyes

Thread Previous | Thread Next
From:
Brandon Allbery
Date:
June 13, 2018 00:19
Subject:
Re: need second pair of eyes
Message ID:
CAKFCL4V7dNjJ0ouSZHAfW9_nQNe-=TDr9BPpwO-39BirVwBbcg@mail.gmail.com
You're trying to do it all in one regex. That doesn't work; what you tried
will attempt to test that the same *substring* of the regex matches both of
those, which is not possible because they're both literal. So any given
substring has to be one, the other, or neither, it can't simultaneously be
both.

Either use two different matches, or put something like  .*  in between
instead of trying to use & or &&.

On Tue, Jun 12, 2018 at 8:15 PM ToddAndMargo <ToddAndMargo@zoho.com> wrote:

>  >
>  > On Tue, Jun 12, 2018 at 7:35 PM ToddAndMargo <ToddAndMargo@zoho.com
>  > <mailto:ToddAndMargo@zoho.com>> wrote:
>  >
>  >     On 06/12/2018 03:41 PM, ToddAndMargo wrote:
>  >      > Hi Alk,
>  >      >
>  >      > What am I dong wrong here?
>  >      >
>  >      >
>  >      > $ p6 'my $Line = "wine-patched/archive/staging-/xxxxx.tar.gz"; if
>  >     $Line
>  >      > ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say
>  >     "yes"}
>  >      > else {say "no};'
>  >      >
>  >      > ===SORRY!===
>  >      > Expression needs parens to avoid gobbling block
>  >      > at -e:1
>  >      > ------> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >      > Missing block (apparently claimed by expression)
>  >      > at -e:1
>  >      > ------> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >      >
>  >      >
>  >      > :'(
>  >      >
>  >      > -T
>  >
>  >
>  >     This fixed it:
>  >
>  >     $ p6 'my $Line = "wine-patched/archive/staging-/xxxxx.tar.gz";if
> $Line
>  >     ~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say
>  >     "yes"}
>  >     else {say "no"};'
>  >
>  >
>  >     How do I use "|" instead of "/"?  I am trying to rid myself of the
>  >     /\/\//\//\\/\/  tree
>  > On 06/12/2018 04:37 PM, Brandon Allbery wrote:
> > Same as in perl 5:  m<delim> ... <delim>
> >
> > m|xxx|
>
> so I have to include the m
>
> Doesn't work
>
>
> $ p6 'my $Line = "wine-patched/archive/staging-/xxxxx.tar.gz";if $Line
> ~~ m| "wine-patched\/archive\/staging\-\/"  &  ".tar.gz" |  {say "yes"}
> else {say "no"};'
> no
>
>
> :'(
>


-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

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