diff --git a/src/index.ts b/src/index.ts index c72585b..549587f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -228,7 +228,7 @@ export function globSync(patternsOrOptions: string | string[] | GlobOptions, opt */ const UNESCAPED_GLOB_SYMBOLS_RE = os.platform() === 'win32' - ? /(?\\?)(?[()[\]{}]|^!|[!+@](?=\())/g - : /(?\\?)(?[()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; + ? /(\\?)([()[\]{}]|^!|[!+@](?=\())/g + : /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; export const escapePath = (pattern: string): string => pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');