427
}
428
}
430
>
if (value === '') {
431
return neverMatchRegex;
432
}
434
>
let sanitizedValue: string;
435
>
436
>
// Match both path separators if it looks like a path
437
>
if (value.includes('/') || value.includes('\\')) {
438
let pattern = value.replace(/[/\\]/g, '%%PATH_SEP%%');
439
pattern = escapeRegExpCharacters(pattern);
440
pattern = pattern.replace(/%%PATH_SEP%%*/g, '[/\\\\]');
441
sanitizedValue = `^(?:\\.[/\\\\])?${pattern}`;
443
>
sanitizedValue = escapeRegExpCharacters(value);
444
>
}
445
>
446
>
return new RegExp(`^${sanitizedValue}\\b`);
447
>
}
448
449
// ---- Default rules ----------------------------------------------------------