Creating RegEx pattern from date range
Posted: Mon Jan 17, 2011 1:00 pm
Good day,
I am new to PHP, but I thought I'd at least ask and see where this leads... I have a perl script that requires a date range to be entered as a regular expression. I cannot change this script.
For example:
2010(10(0[7-9]|1[0-9]|2[0-9]|3[0-1])|11(0[1-5])) gives me a date range of 20101007 - 20101105, which is the format YYYYMMDD.
I'm wondering where I start in taking a date range and converting it into a regular expression that can be passed onto this script. I can see how to do this if you're only replacing the year and month, but specific days can make the regex rather complicated.
Any thoughts? Ideas on where to start? Is this easy and I'm just not in the right mindset?
Thanks.
I am new to PHP, but I thought I'd at least ask and see where this leads... I have a perl script that requires a date range to be entered as a regular expression. I cannot change this script.
For example:
2010(10(0[7-9]|1[0-9]|2[0-9]|3[0-1])|11(0[1-5])) gives me a date range of 20101007 - 20101105, which is the format YYYYMMDD.
I'm wondering where I start in taking a date range and converting it into a regular expression that can be passed onto this script. I can see how to do this if you're only replacing the year and month, but specific days can make the regex rather complicated.
Any thoughts? Ideas on where to start? Is this easy and I'm just not in the right mindset?
Thanks.