Noah Garrett Wallach <noah-l...@enabled.com> wrote on Thu, 17 Sep 2009
13:23:37 -0700

>Hi there Perl folks,
>
>
>Okay I am trying to figure this out.
>
>I am trying to match the following:
>
>
>$line = "blah&blah&blah"
>
>
>so I have the following line to match that
>
>$line =~ /((?:blah).*?){0,5}/;
>But I want to capture "blah" in a variable like
>$capture = $1;

     Assigning to variables in list context will return the "captured"
portions of the match, if any. So, given ':' appears somewhere in your
target line, a possible approach might be:

     $line = "Testing:blah&blah&blah";
($blahpart) = $line =~ /.*:(.{5})/;

Hth,
Jim

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to