diff --git a/wherehows-web/app/utils/validators/regexp.ts b/wherehows-web/app/utils/validators/regexp.ts index 10e002cf1a..7c34c9f84c 100644 --- a/wherehows-web/app/utils/validators/regexp.ts +++ b/wherehows-web/app/utils/validators/regexp.ts @@ -13,11 +13,11 @@ const emptyRegexSource = '(?:)'; */ const validateRegExp = ( pattern: string, - customChecker?: (pattern: string) => boolean + customChecker?: (pattern: any) => boolean ): { isValid: boolean; regExp: RegExp } => { const regExp = new RegExp(pattern); const { source } = regExp; - const isValid = source !== emptyRegexSource; + const isValid = !!pattern && source !== emptyRegexSource; if (isValid && customChecker && customChecker(pattern)) { return { isValid, regExp };