Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Help with placing the matches of a regex into an Array

by stevieb (Curate)
on Apr 28, 2012 at 15:53 UTC ( #967825=note: print w/ replies, xml ) Need Help??


in reply to Help with placing the matches of a regex into an Array

I can make the match work by removing the square brackets (character class):

while ( my $link = <DATA> ){ $link =~ m/onclick="document\.location\.href='(.+)'"/g; say $1; } __DATA__ onclick="document.location.href='hello'" onclick="document.location.href='there'" onclick="document.location.href='world'" __END__ %./match.pl hello there world


Comment on Re: Help with placing the matches of a regex into an Array
Download Code
Replies are listed 'Best First'.
Re^2: Help with placing the matches of a regex into an Array
by LanX (Canon) on Apr 28, 2012 at 15:58 UTC
    true! putting a dot into a character class [.] is like escaping it \.

    But why did the OP say that he got one match?

    Cheers Rolf

      I don't know. There is not enough context, nor any sample data. For all I know, the @game_array could have been previously populated with something somewhere else. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967825]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2015-07-30 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls