Skip to content

Instantly share code, notes, and snippets.

@tylerflint
Created December 30, 2011 19:28
Show Gist options
  • Save tylerflint/1541139 to your computer and use it in GitHub Desktop.
Save tylerflint/1541139 to your computer and use it in GitHub Desktop.
wacko regex
# cron schedule regex:
#
# Needed a way to break this monster into nibblets.
# It all gets combined in the end for the most horrific regex i've ever seen!
#
# minute:
# list: (([0-5]?[0-9]),)+([0-5]?[0-9])
# mod: (0|\*)\/[0-5]?[0-9]
# expl: [0-5]?[0-9]
# final: ((0|\*)\/[0-5]?[0-9]|[0-5]?[0-9]|(([0-5]?[0-9]),)+([0-5]?[0-9])|\*)
# hour:
# list: ((2[0-3]|1[0-9]|[0-9]),)+(2[0-3]|1[0-9]|[0-9])
# mod: (0|\*)\/(2[0-3]|1[0-9]|[0-9])
# expl: (2[0-3]|1[0-9]|[0-9])
# final: ((0|\*)\/(2[0-3]|1[0-9]|[0-9])|(2[0-3]|1[0-9]|[0-9])|((2[0-3]|1[0-9]|[0-9]),)+(2[0-3]|1[0-9]|[0-9])|\*)
# day of month:
# list: ((3[0-1]|[1-2][0-9]|[0-9]),)+(3[0-1]|[1-2][0-9]|[0-9])
# mod: (0|\*)\/(3[0-1]|[1-2][0-9]|[0-9])
# expl: (3[0-1]|[1-2][0-9]|[0-9])
# final: ((0|\*)\/(3[0-1]|[1-2][0-9]|[0-9])|(3[0-1]|[1-2][0-9]|[0-9])|((3[0-1]|[1-2][0-9]|[0-9]),)+(3[0-1]|[1-2][0-9]|[0-9])|\*)
# month:
# list: ((1[0-2]|[1-9]),)+(1[0-2]|[1-9])
# mod: (0|\*)\/(1[0-2]|[1-9])
# expl: (1[0-2]|[1-9])
# abbrv:
# final:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment