Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: a regular expression question

by toolic (Bishop)
on Dec 18, 2012 at 15:12 UTC ( #1009395=note: print w/replies, xml ) Need Help??

in reply to a regular expression question

Be less greedy:

Replies are listed 'Best First'.
Re^2: a regular expression question
by brassbin (Novice) on Dec 18, 2012 at 15:26 UTC

    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.

        Thank you toolic, roboticus!

        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

        thank you

        doesn't show up

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009395]
marioroy LWP::Simple works best with Perl v5.26 on Windows. Any Perl version is fine on Cygwin and Unix.
[karlgoethebier]: Hi mario
[marioroy]: Hi karlgoethebier.
[karlgoethebier]: "Long time No See" ;-)
[marioroy]: Yes. I've been working on MCE and MCE::Shared. These are completed and released. MCE 1.830 and MCE::Shared 1.831. Saw the LWP::Simple and P::FM thread and thought to help out.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-09-23 15:52 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (272 votes). Check out past polls.