G
gorjusborg
I'm trying to match a string (which happens to be an entire file) as
many times as it can, and capture a portion to a variable.
The results I'm getting with the method I'm trying to use are..
unexpected.
Here is the code:
while ($text =~ m{$pattern1($pattern2)$pattern3\(}msg) {
push @instance, "$1";
}
I've shortened the patterns I'm using to place holders because they are
pretty complex, and I'm pretty sure they're working as I expect.
The problem is, though I'm getting the _number_ of matches I'd expect
(verified visually), I'm only getting the captured text from the first
match in $1, but repeated the number of times the pattern matches in
the text... What gives??
=Brandon=
many times as it can, and capture a portion to a variable.
The results I'm getting with the method I'm trying to use are..
unexpected.
Here is the code:
while ($text =~ m{$pattern1($pattern2)$pattern3\(}msg) {
push @instance, "$1";
}
I've shortened the patterns I'm using to place holders because they are
pretty complex, and I'm pretty sure they're working as I expect.
The problem is, though I'm getting the _number_ of matches I'd expect
(verified visually), I'm only getting the captured text from the first
match in $1, but repeated the number of times the pattern matches in
the text... What gives??
=Brandon=