Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by stevieb (Hermit)
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
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 studying the Monastery: (6)
As of 2014-07-12 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (239 votes), past polls