patgas has asked for the wisdom of the Perl Monks concerning the following question:
On a whim, I decided to sift through all my code and see which modules and pragma's I used/required the most. So I came up with this regex:
m,(use|require)[\s\+]+([\w:]+)\s*[^;]*;,igsBut I can't figure out how to ignore commented lines. I've been trying to figure out negative lookbehinds, cause that seems to be the thing to do.
m,(?<!- )(use|require)[\s\+]+([\w:]+)\s*[^;]*;,igs That's not working for me, though. How would I go about doing this? Already this is by far the toughest regex I've ever had to write..."We're experiencing some Godzilla-related turbulence..."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is this the time for a negative lookbehind?
by dws (Chancellor) on Dec 20, 2001 at 00:31 UTC | |
|
(tye)Re: Is this the time for a negative lookbehind?
by tye (Sage) on Dec 20, 2001 at 03:42 UTC | |
|
Re: Is this the time for a negative lookbehind?
by Juerd (Abbot) on Dec 20, 2001 at 00:45 UTC | |
|
Re: Is this the time for a negative lookbehind?
by merlyn (Sage) on Dec 20, 2001 at 06:42 UTC | |
|
Re: Is this the time for a negative lookbehind?
by patgas (Friar) on Dec 20, 2001 at 00:59 UTC | |
|
Re: Is this the time for a negative lookbehind?
by tradez (Pilgrim) on Dec 20, 2001 at 01:28 UTC |