Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: multiple regexp matches in multi line string

by k_manimuthu (Monk)
on May 07, 2010 at 10:12 UTC ( #838904=note: print w/ replies, xml ) Need Help??


in reply to multiple regexp matches in multi line string

For your code, you used the greedy match (.*). You will use the non-greedy match (.*?) in your code, you will get all the addresses.

while($lines =~ m/traffic-gen.*?client address = 192\.0\.0\.(\d+).*?da +ta units received = (\d+).*?jitter/scgi) { print $1, "\tyes\t",$2,"\n"; push @ones, $1; push @twos, $2; }


Comment on Re: multiple regexp matches in multi line string
Download Code
Re^2: multiple regexp matches in multi line string
by wirelesscharlie (Initiate) on May 10, 2010 at 06:38 UTC
    Yes that worked!! Thanks :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2014-07-26 11:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls