Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 scrutinizing the Monastery: (5)
As of 2014-12-29 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls