Re: Need help with a variable inside a regex

2018-09-15 Thread ToddAndMargo
On Sat, Sep 15, 2018 at 4:09 AM ToddAndMargo > wrote: On 09/15/2018 12:42 AM, ToddAndMargo wrote: > Hi All, > > I am truing to use a variable inside a regex. > > This work (without the variable): >     $ p6 'my $x="6937-2.2.19882.exe

Re: Need help with a variable inside a regex

2018-09-15 Thread Brandon Allbery
To interpolate a variable as a regex instead of as a string literal, you need to wrap it in < >. On Sat, Sep 15, 2018 at 4:09 AM ToddAndMargo wrote: > On 09/15/2018 12:42 AM, ToddAndMargo wrote: > > Hi All, > > > > I am truing to use a variable inside a regex. > > > > This work (without the vari

Re: Need help with a variable inside a regex

2018-09-15 Thread ToddAndMargo
On 09/15/2018 12:42 AM, ToddAndMargo wrote: Hi All, I am truing to use a variable inside a regex. This work (without the variable):    $ p6 'my $x="6937-2.2.19882.exe"; if $x ~~ m/ .*? <<:\N**4>>  "-" (.*?) ".exe" / {say "yes";}'    yes I want to turn `<<:\N**4>>` into a variable:    $

Need help with a variable inside a regex

2018-09-15 Thread ToddAndMargo
Hi All, I am truing to use a variable inside a regex. This work (without the variable): $ p6 'my $x="6937-2.2.19882.exe"; if $x ~~ m/ .*? <<:\N**4>> "-" (.*?) ".exe" / {say "yes";}' yes I want to turn `<<:\N**4>>` into a variable: $ p6 'my $x="6937-2.2.19882.exe"; my $i="<<:\\N**4