tiny-glob icon indicating copy to clipboard operation
tiny-glob copied to clipboard

Invalid regular expression: /^(([^\\]*)|\.$/: Unterminated group

Open mrmlnc opened this issue 6 years ago • 1 comments

Environment

  • Windows 10
  • Node.js 12.3.1
  • tiny-glob 0.2.6
  • globrex 0.1.2

Actual behaviour

const tg = require('tiny-glob/sync');

const entries = tg('{*,./package.json,package.json}');

console.dir(entries, { colors: true });
D:\OpenSource\fast-glob\node_modules\globrex\index.js:42
                    path.segments.push(new RegExp(segment, flags));
                                       ^

SyntaxError: Invalid regular expression: /^(([^\\]*)|\.$/: Unterminated group
    at new RegExp (<anonymous>)
    at add (D:\OpenSource\fast-glob\node_modules\globrex\index.js:42:40)
    at globrex (D:\OpenSource\fast-glob\node_modules\globrex\index.js:62:13)
    at module.exports (D:\OpenSource\fast-glob\node_modules\tiny-glob\sync.js:75:20)
    at Object.<anonymous> (D:\OpenSource\fast-glob\test.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)

Expected behaviour

I see entries.

mrmlnc avatar Jun 11 '19 05:06 mrmlnc

Thank you! I'm working on a fix for this in the next release. Are you sure path separators are valid characters inside brace expansions?

terkelg avatar Apr 21 '20 15:04 terkelg