diff --git a/packages/regex/src/__tests__/index.ts b/packages/regex/src/__tests__/index.ts index 8c0be06e8..e3b70f94c 100644 --- a/packages/regex/src/__tests__/index.ts +++ b/packages/regex/src/__tests__/index.ts @@ -48,7 +48,7 @@ const subDomain = 'sub.another-example.com' const dashStartDomain = '-sub.another-example.com' const uppercaseDomain = 'SUB.another-example.com' const longTldDomain = 'sub.another-example.verylongtld' -const cronTest = '0/15*-' +const cronTest = '0 0 0 * * 0 1-4' const digitsTest = '0123456789' const emailTest = 'test@scaleway.com' const fourDigitsTest = '2345' diff --git a/packages/regex/src/index.ts b/packages/regex/src/index.ts index 026301eaf..53694c10d 100644 --- a/packages/regex/src/index.ts +++ b/packages/regex/src/index.ts @@ -22,7 +22,7 @@ export const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/ export const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/ -export const cron = /^[0-9,/*-]+$/ +export const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/ export const digits = /^[0-9]*$/ export const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/