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.
i haven't figured out all the rules yet of posting, but i meant to say thank you for your help
i don't know why a line that contains the words
doesn't show up
A Programming Language, 1962
Programming the 1900 series in COBOL, 1974
Algorithms + Data Structures = Programs, 1976
The C Programming Language, 1978
System V - Interface definition, 1986
Z80 Assembly Language Programming, 1979
TheSOURCE User's Manual, 1979
The C Primer, 1983
Interactive Fortran 77, A Hands on Approach, 1984
Perl.1 man page, 1991
Results (330 votes),