Merge pull request #6554 from Budibase/bug/sev3/blank-field-regex-not-working

Make null values empty for regex validation
This commit is contained in:
melohagan 2022-07-05 10:08:51 +01:00 committed by GitHub
commit d2ffd68ebf
1 changed files with 3 additions and 0 deletions

View File

@ -278,6 +278,9 @@ const notEqualHandler = (value, rule) => {
// Evaluates a regex constraint // Evaluates a regex constraint
const regexHandler = (value, rule) => { const regexHandler = (value, rule) => {
const regex = parseType(rule.value, "string") const regex = parseType(rule.value, "string")
if (!value) {
value = ""
}
return new RegExp(regex).test(value) return new RegExp(regex).test(value)
} }