diff --git a/ui/src/app/schema-form/widget/filter-target/filter-target.component.html b/ui/src/app/schema-form/widget/filter-target/filter-target.component.html
index fcbd80ab8..f1e04538a 100644
--- a/ui/src/app/schema-form/widget/filter-target/filter-target.component.html
+++ b/ui/src/app/schema-form/widget/filter-target/filter-target.component.html
@@ -78,7 +78,7 @@
Required for Regex
-
+
,
{{ error.message }}
diff --git a/ui/src/app/shared/validation/regex.validator.spec.ts b/ui/src/app/shared/validation/regex.validator.spec.ts
index ce8af17ee..4835efd94 100644
--- a/ui/src/app/shared/validation/regex.validator.spec.ts
+++ b/ui/src/app/shared/validation/regex.validator.spec.ts
@@ -11,8 +11,8 @@ describe('RegexValidator', () => {
expect(RegexValidator.isValidRegex(')')).toBe(false);
});
- it('should return false if the regex doesnt begin and end with slashes', () => {
- expect(RegexValidator.isValidRegex('abc')).toBe(false);
+ it('should return true even if the regex doesnt begin and end with slashes', () => {
+ expect(RegexValidator.isValidRegex('abc')).toBe(true);
});
});
});
diff --git a/ui/src/app/shared/validation/regex.validator.ts b/ui/src/app/shared/validation/regex.validator.ts
index be567a0f4..f05fadf8d 100644
--- a/ui/src/app/shared/validation/regex.validator.ts
+++ b/ui/src/app/shared/validation/regex.validator.ts
@@ -1,9 +1,7 @@
-const regexChecker = new RegExp('^\/|\/$', 'g');
-
export class RegexValidator {
static isValidRegex(pattern: string): boolean {
if (!pattern) {
- return true;
+ return false;
}
let regex;
try {
@@ -11,7 +9,7 @@ export class RegexValidator {
} catch (err) {
return false;
}
- return regexChecker.test(pattern);
+ return true;
}
}