Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: dynamic regex

by LanX (Canon)
on Dec 03, 2012 at 23:44 UTC ( #1006965=note: print w/ replies, xml ) Need Help??


in reply to dynamic regex

I don't understand which logic leads from 'Oct 10 05:59:59' to 'Oct 10 05:5[0-2]:'

but yes, you can put a datetime-string into a variable, dynamically manipulate this variable and use it as a pattern within any regex.

my $dt = 'Oct 10 05:59:59'; $dt =~ s/9:59$/[0-2]:/; $file =~ m/$dt/;

HTH!

Cheers Rolf


Comment on Re: dynamic regex
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2015-07-01 18:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (16 votes), past polls