|Welcome to the Monastery|
a regular expression questionby brassbin (Novice)
|on Dec 18, 2012 at 15:05 UTC||Need Help??|
brassbin has asked for the
wisdom of the Perl Monks concerning the following question:
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 uses/\(.*,\s*bob\s*,.*\)//g
i 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!