Updated Client Side Cron Regex

This commit is contained in:
KanniShashankh committed 2023-09-15 02:31:44 +05:30
1 parent 88b6d59051
commit 758300ad18
1 file changed
+13 -1
+13 -1
View File
@@ -18,7 +18,19 @@
let element: HTMLInputElement;
let error: string;
const pattern = String.raw`^[^]+\s+[^]+\s+[^]+\s+[^]+\s+[^]+`;
/*
Below is a regex pattern which allows us to validate the cron string.
The pattern is not perfect, but it is a good start.
Allowed values:
- minute: 0-59
- hour: 0-23
- day of month: 1-31
- month: 1-12
- day of week: 0-6
- wildcard *
- step values
*/
const pattern = "^(\\*|([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\\*\\/([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\\*|([0-9]|1[0-9]|2[0-3])|\\*\\/([0-9]|1[0-9]|2[0-3])) (\\*|([1-9]|1[0-9]|2[0-9]|3[0-1])|\\*\\/([1-9]|1[0-9]|2[0-9]|3[0-1])) (\\*|([1-9]|1[0-2])|\\*\\/([1-9]|1[0-2])) (\\*|([0-6])|\\*\\/([0-6]))$";
onMount(() => {
if (element && autofocus) {