![]() |
|
There's more than one way to do things | |
PerlMonks |
a regular expression questionby brassbin (Novice) |
on Dec 18, 2012 at 15:05 UTC ( #1009391=perlquestion: print w/replies, xml ) | Need Help?? |
brassbin has asked for the
wisdom of the Perl Monks concerning the following question:
hi, i'm processing a netgroup file, trying to delete entries from the netgroup file, here's the issue i have so say i have this pattern in the netgroup file ng1 (-,bob,) (-,dick,) (,jane,) (,bob,) so i want to match the entries "bob" and delete it, here's what i use s/\(.*,\s*bob\s*,.*\)//gi do want to use the "g" flag to match multiple instances, i thought it would match the shortest possible patterns, but it does the opposite, it matches the widest pattern, from the first instance of "bob" all the way to the end of the line, matching the ")" at the end of the line what am i doing wrong? Thank you very much for your help!
Back to
Seekers of Perl Wisdom
|
|