Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
............ keyword=nn ............
where ..'s represent variable numbers of any char.
I would like $1 to be anything upto and including the =
$2 to be nn (can be 1 2 or 3 decimal digits)
$3 to be everything including the space(s) to the end of the line.
I thought this would do it
while(<>) { m/^(.+?\s+keyword=)(\d+)(\s+.+)$/ print "$1-" if $1; print "$2-" if $2; print "$3" if $3; print "\n"; }
But I get nothing?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regex problem
by Abigail-II (Bishop) on Jul 04, 2002 at 15:12 UTC | |
by Anonymous Monk on Jul 04, 2002 at 16:16 UTC | |
by amphiplex (Monk) on Jul 04, 2002 at 18:13 UTC | |
Re: Regex problem
by amphiplex (Monk) on Jul 04, 2002 at 15:13 UTC | |
Re: Regex problem
by vladb (Vicar) on Jul 04, 2002 at 15:15 UTC | |
Re: Regex problem
by DamnDirtyApe (Curate) on Jul 04, 2002 at 15:14 UTC | |
Re: Regex problem
by screamingeagle (Curate) on Jul 05, 2002 at 00:14 UTC |