Regular Expression & 5-Field Cron Schedule Cheat Sheet

Quick reference for common regex tokens, lookaheads, and Unix/Linux 5-field cron syntax with instant browser testers and schedule previews.

Quick Tool Comparison & Cheat Table

Task / PatternWhat It SolvesRecommended Local App
`^\d{4}-\d{2}-\d{2}$`Match ISO date `YYYY-MM-DD`Regex Tester
`^[a-z0-9-]+$`Validate URL-safe lowercase slugCyrilex Regex Visualizer
`*/15 * * * *`Run every 15 minutesVisual Cron Editor
`0 2 * * 1-5`Run at 02:00 Monday–FridayCron Next Runs

Five-Field Cron Order Made Unforgettable

Standard Unix/Cronie schedules follow `minute hour day-of-month month day-of-week`. Remember that day-of-week uses `0` or `7` for Sunday, and combining both day-of-month and day-of-week triggers an OR match in classic Vixie cron β€” always preview the next five run timestamps before deploying to production.

Avoiding Catastrophic Regex Backtracking

Nested quantifiers like `(a+)+$` can freeze JavaScript and Python runtimes on crafted inputs. Prefer explicit negated character classes (`[^"\n]+`), anchor patterns cleanly, and test edge cases locally before shipping validation rules.

Testing Patterns Safely in the Browser

Use a live visual regex inspector to highlight capture groups and flags (`g`, `i`, `m`, `u`) alongside sample log lines without sending proprietary server logs to external websites.

Frequently Asked Questions

Why did my cron job run an hour early or late?

Most production servers run UTC while local desktops run regional time zones with daylight saving shifts. Check UTC vs local previews explicitly.

What is the difference between `*` and `+` in regex?

`*` matches zero or more repetitions, whereas `+` requires at least one match.

How do I match literally a dot or question mark?

Escape regex metacharacters with a backslash: `\.` matches a literal period and `\?` matches a literal question mark.