Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: regex-matching the date

by stuffy (Monk)
on May 12, 2001 at 11:28 UTC ( #79924=note: print w/replies, xml ) Need Help??


in reply to regex-matching the date

had a typo, my regex should be
/\w{3}\s+\w{3}\s+\d+/



Stuffy

Replies are listed 'Best First'.
Re: Re: regex-matching the date
by rob_au (Abbot) on May 12, 2001 at 18:00 UTC
    Hrmmm ... it seems to work for me - I'm not entirely sure that I know what in context you are trying to use it ... Try this ...
    $var = "Sun Apr 1 10:27:03 CDT"; if ($var =~ /(\w{3}\s+\w{3}\s+\d+)/) { print $1."\n"; };
    This worked fine for me in my testing - Note the additional brackets around the regex to allow the result to be pulled from $1. If you are still having problems, post again with a bit more context as to where you are using this regex and someone with more experience than myself may be able to help further.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79924]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2018-11-15 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (189 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!