Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want___DATA___ #Pattern 1 - aaa <anything> bbb <anything> ccc <whitespaces> dddd aaa xxxxxxx bbb ccc dddd ------------------------------------- # Pattern 2 - aaa <anything> bbb <anything> ccc <whitespaces> dddd aaa xxxxxxxxxxxxxxxxxxxxx xxxxxxx bbb xxxxxxxxxxxxxxxxxxxxx xxxx xx ccc dddd
to give me 2. But it gives me 1. I assume that the culprut is .* Any way to get around this?print $#{[$lines =~ /aaa.*bbb.*ccc\s*dddd/gsi]} + 1 . "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex matches more than I want
by duff (Parson) on Dec 02, 2003 at 14:38 UTC | |
by Anonymous Monk on Dec 03, 2003 at 06:36 UTC | |
|
Re: regex matches more than I want
by ChrisR (Hermit) on Dec 02, 2003 at 13:44 UTC |