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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: a regular expression question
by toolic (Bishop) on Dec 18, 2012 at 15:12 UTC | |
by brassbin (Novice) on Dec 18, 2012 at 15:26 UTC | |
by roboticus (Chancellor) on Dec 18, 2012 at 15:41 UTC | |
by brassbin (Novice) on Dec 18, 2012 at 17:07 UTC | |
by brassbin (Novice) on Jan 29, 2013 at 14:29 UTC | |
by brassbin (Novice) on Dec 18, 2012 at 22:39 UTC |