Skip to content

Commit 3794855

Browse files
committed
Improves special character regex in filter
Simplifies the regular expression used to detect special characters within filter values. This enhances readability and potentially improves performance.
1 parent cf10a54 commit 3794855

File tree

1 file changed

+3
-3
lines changed
  • src/Exceptionless.Web/ClientApp/src/lib/features/events/components/filters

1 file changed

+3
-3
lines changed

src/Exceptionless.Web/ClientApp/src/lib/features/events/components/filters/helpers.svelte.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ export function quote(value?: null | string): string | undefined {
8383

8484
export function quoteIfSpecialCharacters(value?: null | string): null | string | undefined {
8585
// Check for lucene special characters or whitespace
86-
const regex = new RegExp('\\+|\\-|\\&|\\||\\!|\\(|\\)|\\{|\\}|\\[|\\]|\\^|\\"|\\~|\\*|\\?|\\:|\\\\|\\/|\\s', 'g');
87-
88-
if (value && value.match(regex)) {
86+
const regex = /[+\-&|!(){}\[\]^"~*?:\\/\\s]/;
87+
88+
if (value && regex.test(value) {
8989
return quote(value);
9090
}
9191

0 commit comments

Comments
 (0)