I would like to create a regex for a 24h unix timestamp starting from, say: 01/01/2015 00:00:00 **(1420066800)** to 01/01/2015 23:59:59 **(1420153199)**
, which is a difference of 86399 sec. in the unix time stamp format.
I'm using the range_regex
python lib, but it's buggy for such a huge ranges. The range_to_pattern
method (range_to_pattern(1420066800, 1420153199)
) would produce a regex of: 1420[0-1][5-6][3-6][1-8]\\d{2}
This is fine for the static bounds to create the regex, but when it comes to values like: 1420159111
since the 7 digit (9) from the left is not in the third range group ([3-6]).
Can someone provide a better python3 lib or a workaround on how to create a regex for 86400 sec. of a day?
As per my comment above, you are using the wrong function from that library.
You should use the following:
range_to_regex(1420066800, 1420153199)
This returns the correct regex:
142006680\d|14200668[1-9]\d|14200669\d{2}|142006[7-9]\d{3}|14200[7-9]\d{4}|14201[0-4]\d{4}|142015[0-2]\d{3}|1420153[0-1]\d{2}