提交 f933faa1 编写于 作者: B Benjamin Pasero

Revert "Glob regex is inefficient (fixes #5438)"

This reverts commit cfdcde74.
上级 a6ac55b0
......@@ -20,9 +20,6 @@ export interface SiblingClause {
const PATH_REGEX = '[/\\\\]'; // any slash or backslash
const NO_PATH_REGEX = '[^/\\\\]'; // any non-slash and non-backslash
const BEGINS_WITH_PATH_REGEX = PATH_REGEX + '.*?'; // anything that begins with a path or just the path itself
const ENDS_WITH_PATH_REGEX = '.+?' + PATH_REGEX;
function starsToRegExp(starCount: number): string {
switch (starCount) {
case 0:
......@@ -30,11 +27,10 @@ function starsToRegExp(starCount: number): string {
case 1:
return NO_PATH_REGEX + '*?'; // 1 star matches any number of characters except path separator (/ and \) - non greedy (?)
default:
// Matches: (Path Sep OR Path Val followed by Path Sep OR Path Sep followed by Path Val) 0-many times
// Matches: (Path Sep OR Path Val followed by Path Sep OR Path Sep followed by Path Val) 0-many times
// Group is non capturing because we don't need to capture at all (?:...)
// Overall we use non-greedy matching because it could be that we match too much
return '(?:' + BEGINS_WITH_PATH_REGEX + '|' + ENDS_WITH_PATH_REGEX + ')*?';
return '(?:' + PATH_REGEX + '|' + NO_PATH_REGEX + '+' + PATH_REGEX + '|' + PATH_REGEX + NO_PATH_REGEX + '+)*?';
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册