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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple regexp matches in multi line string
by wirelesscharlie (Initiate) on May 10, 2010 at 06:38 UTC |