rsriram has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am writing a script to search through a ASCII file for a pattern <BOXIND NUM="x" ID="BX1.xx.xxx"/> and push the contents of the ID to a array.
while ($file =~ /<BOXIND NUM=\"(.+)\" ID=\"(.*?)\"\/>/g) {push(@ind,$2);}
@ind is the array to which I need to add the ID values. I there are two BOXIND elements in a same line, this regex returns only the last found element in that line. Can someone let me know what went wrong in this pattern?
Sriram
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using a regex search pattern
by Corion (Patriarch) on Jun 21, 2006 at 09:34 UTC | |
|
Re: Using a regex search pattern
by jwkrahn (Abbot) on Jun 21, 2006 at 10:11 UTC | |
|
Re: Using a regex search pattern
by leocharre (Priest) on Jun 21, 2006 at 13:57 UTC |