What is the best way to generate a regexp time range (YYYYMMDD) from two dates from a different format, let’s say (D.M.YYYY)? For example, three separate cases:
input date 1 = "20.11.2012"
input date 2 = "27.11.2012"
Wanted result = "2012112[0-7]"
input date a = "31.12.2011"
input date b = "6.1.2012"
Wanted result = "20111231\\|2012010[1-6]"
input date x = "28.1.2012"
input date y = "4.2.2012"
Wanted result = "2012012[8-9]\\|2012013[0-1]\\|2012020[1-4]"
Or is there a better regexp for getting the same result than what the “Wanted result” achieves in the current form? A week will suffice in the total range, and longer than 30 days is not required.
Given that your range is small (7 days), it’s a lot easier to simply generate all of the dates.
Here is a script to do that:
Example Usage: