TheFifthDeuce has asked for the wisdom of the Perl Monks concerning the following question:
I thought using the /g option grabbed ALL matches per line. What am I doing wrong? Thanksopen(FILE, $file) or &error; @data = <FILE>; close(FILE); @extracted = (); foreach(@data){ if($_ =~ /.*?(foo\d+).*?/g){ push @extracted, $1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex help
by japhy (Canon) on Jul 08, 2002 at 19:22 UTC | |
|
Re: Regex help
by joealba (Hermit) on Jul 08, 2002 at 19:14 UTC | |
by japhy (Canon) on Jul 08, 2002 at 19:26 UTC | |
|
Re: Regex help
by DamnDirtyApe (Curate) on Jul 08, 2002 at 19:10 UTC | |
by japhy (Canon) on Jul 08, 2002 at 19:24 UTC | |
|
Re: Regex help
by TheFifthDeuce (Novice) on Jul 08, 2002 at 19:35 UTC |