in reply to Parsing with reg ex
use strict; use warnings; # # slurp file # my $file_contents = ""; { local $/; $file_contents = <DATA>; } # # "parse" file # while ($file_contents =~ m/\((.*?)\)/sg) { my $match = $1; $match =~ s/\n//g; print "[$match]\n"; } __DATA__ prematch (match) postmatch adsf (madfa tch) asdf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parsing with reg ex
by ByteOrNybble (Novice) on Oct 25, 2002 at 03:02 UTC |