100% Client-Side • 0 B Data Leaves Browser
validation
5-Field Unix Cron Expression Regex
Validates standard 5-to-7 field crontab expressions including wildcard, ranges, steps, and shortcuts.
Regular Expression Pattern:
/^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/
Valid Match Example:
*/15 0 1,15 * 1-5
Invalid / Non-Match Example:
invalid cron string
Regex Syntax Breakdown & Explanation
- •Matches standard 5 to 7 space-separated fields for minute, hour, day of month, month, and day of week.
Implementation in Popular Languages
JavaScript / TypeScript
const regex = /^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
const isValid = regex.test("*/15 0 1,15 * 1-5");
console.log(isValid); // truePython (re)
import re
pattern = r"^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$"
match = re.match(pattern, "*/15 0 1,15 * 1-5")
print(bool(match)) # TrueGo (regexp)
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$`)
fmt.Println(re.MatchString("*/15 0 1,15 * 1-5"))
}Frequently Asked Questions
Frequently Asked Questions
Everything you need to know regarding specifications, syntax, and security best practices.
The regular expression pattern is /^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/. Validates standard 5-to-7 field crontab expressions including wildcard, ranges, steps, and shortcuts.