in reply to
a regular expression question
Be less greedy:
i know the netgroup file i'm processing probably doesn't have 3 spaces before the first comma, what if it does?
i thought regular expression matches the short possible pattern, not the longest, am i wrong?
As toolic mentioned, the .* construct is greedy and tries to get the longest match. If you turn it into .*?, it then looks for the shortest match. If you read the link he provided, you could verify that yourself.
When your only tool is a hammer, all problems look like your thumb.
You may view the original node and the consideration vote tally.
i don't know why a line that contains the words
doesn't show up
i haven't figured out all the rules yet of posting, but i meant to say thank you for your help
Use subroutines for code reuse
Master regular expressions
Write my GUIs with Perl
Abandon CGI in favor of some modern web framework
Put my code in modules
Create CPAN distributions
test and document my code as I write it
Write OOP with or without animal help
Finally switch to a modern Perl style
Create a killer application with Perl
Detoxify from Perl and PerlMonks
Choose another language because Perl is dead
Learn to program for mobile devices
Complete my secret world domination project
None, because the road to hell is paved with good intentions
Results (238 votes),