219
break;
220
}
222
>
case '?':
223
regEx += NO_PATH_REGEX; // 1 ? matches any single character except path separator (/ and \)
224
continue;
226
>
case '*':
227
regEx += starsToRegExp(1);
228
continue;
230
>
default:
231
regEx += escapeRegExpCharacters(char);
233
>
}
234
>
235
>
// Tail: Add the slash we had split on if there is more to
236
>
// come and the remaining pattern is not a globstar
237
>
// For example if pattern: some/**/*.js we want the "/" after
238
>
// some to be included in the RegEx to prevent a folder called
239
>
// "something" to match as well.
240
>
if (
241
>
index < segments.length - 1 && // more segments to come after this
242
(
243
segments[index + 1] !== GLOBSTAR || // next segment is not **, or...
244
index + 2 < segments.length // ...next segment is ** but there is more segments after that
246
>
) {
247
regEx += PATH_REGEX;
248
}
250
>
251
>
// update globstar state
252
>
previousSegmentWasGlobStar = (segment === GLOBSTAR);
253
>
});
254
>
}
255
>
256
>
return regEx;
257
>
}
258
259
// regexes to check for trivial glob patterns that just check for String#endsWith