From 32d5783d97394aee3111b23528b5b72d3548d210 Mon Sep 17 00:00:00 2001 From: Davison Long <dlong@nextgentech.net> Date: Tue, 9 Mar 2021 01:38:29 -0500 Subject: [PATCH] add question mark character to strictRegex --- index.js | 2 +- test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 5582651..9bc9897 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ var isExtglob = require('is-extglob'); var chars = { '{': '}', '(': ')', '[': ']'}; -var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; +var strictRegex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; module.exports = function isGlob(str, options) { diff --git a/test.js b/test.js index 4fcae29..6654407 100644 --- a/test.js +++ b/test.js @@ -19,6 +19,10 @@ describe('isGlob', function() { assert(isGlob('!*.js')); assert(isGlob('!foo')); assert(isGlob('!foo.js')); + assert(isGlob('foo?')); + assert(isGlob('foo?.js')); + assert(isGlob('bar?/foo.js')); + assert(isGlob('bar?/foo?.js')); assert(isGlob('**/abc.js')); assert(isGlob('abc/*.js')); assert(isGlob('@.(?:abc)'));