Skip to content

Commit

Permalink
Merge pull request #336 from Trott/dere
Browse files Browse the repository at this point in the history
fix: adjust inefficient regular expression
  • Loading branch information
mrmlnc authored Jan 2, 2022
2 parents 2d1b749 + c6c0ca5 commit 92b68d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/utils/pattern.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe('Utils → Pattern', () => {

it('should return false for unfinished regex character class', () => {
assert.ok(!util.isDynamicPattern('['));
assert.ok(!util.isDynamicPattern('['.repeat(999999)));
assert.ok(!util.isDynamicPattern('[abc'));
});

Expand Down
2 changes: 1 addition & 1 deletion src/utils/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const GLOBSTAR = '**';
const ESCAPE_SYMBOL = '\\';

const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/;
const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/;
const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/;
const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/;
Expand Down

0 comments on commit 92b68d9

Please sign in to comment.