2 * is-glob <https://github.com/jonschlinkert/is-glob>
4 * Copyright (c) 2014-2017, Jon Schlinkert.
5 * Released under the MIT License.
8 var isExtglob = require('is-extglob');
9 var chars = { '{': '}', '(': ')', '[': ']'};
10 var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
11 var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/;
13 module.exports = function isGlob(str, options) {
14 if (typeof str !== 'string' || str === '') {
22 var regex = strictRegex;
25 // optionally relax regex
26 if (options && options.strict === false) {
30 while ((match = regex.exec(str))) {
31 if (match[2]) return true;
32 var idx = match.index + match[0].length;
34 // if an open bracket/brace/paren is escaped,
35 // set the index to the next closing character
37 var close = open ? chars[open] : null;
39 var n = str.indexOf(close, idx);