On 03/13/2017 07:58 PM, Brandon Allbery wrote:
There is actually a third issue in that spaces are *ignored* in regexes,
so you actually end up with $/[0] eq ' Test'. Use the <.ws> rule to
avoid this. (The leading dot prevents that whitespace from additionally
being captured as $/<ws> which here would be pointless. You might also
want one before the literal open paren so you don't also eat any spaces
there.)

#!/usr/bin/perl6
my $x='sub Test () { #`(Sub|63218616) ... }';
$x ~~ m/sub <.ws> (.*?) <.ws> \(/;

Thank you for the help!

Never could be </.ws> to work.  :'(

say "$x\n$0";


On Mon, Mar 13, 2017 at 10:52 PM, Brandon Allbery <allber...@gmail.com
<mailto:allber...@gmail.com>> wrote:

    You have two problems:

    (1) matches start from 0, not 1.

And I do know that.  Mumble, Mumble.  Short between the headsets

    (2) .* gobbles as much as possible (this is also true in Perl 5) so
    it matches to the ) at the end of (Sub|63218616). As in Perl 5, you
    add a ? to make it take the shortest match instead:


</.ws> worked when I added your ? to the gobble


Thank you for the help!

Reply via email to