gorhill / cronexpr

Cron expression parser in Go language (golang)
687 stars 169 forks source link

support 0N format for numeric field #11

Closed takumakanari closed 8 years ago

takumakanari commented 8 years ago

This p-r makes that '0N' style in expression like '00-09' can be parsing as numeric value.

gorhill commented 8 years ago

Thanks for the pull request.

For day-of-the-month and month, 00 is not a valid value. This could be corrected by using a different regex for all cases. Instead of:

[0-9]|[1-5][0-9]|0[0-9]
[1-9]|[12][0-9]|3[01]|0[0-9]
...

use:

0?[0-9]|[1-5][0-9]
0?[1-9]|[12][0-9]|3[01]
...
takumakanari commented 8 years ago

@gorhill Thanks for your comment. I fixed the range of day-of-the-month/month and also fixed a regex for all. Could you review it?

gorhill commented 8 years ago

Thanks.