stylelint-bundle-worker.js
function toRegex(pattern, contains, isNegated) {
  var prefix = contains ? '^' : '';
  var after = contains ? '$' : '';
  pattern = ('(?:' + pattern + ')' + after);
  if (isNegated) {
    pattern = prefix + negate(pattern);
  }
  return new RegExp(prefix + pattern);
}
function toRegex(pattern, contains, isNegated) {
  var prefix = contains ? '^' : '';
  var after = contains ? '$' : '';
  pattern = ('(?:' + pattern + ')' + after);
  if (isNegated) {
    pattern = prefix + negate(pattern);
  }
  return new RegExp(prefix + pattern);
}
Create the regex to do the matching. If
the leading character in the `pattern` is `!`
a negation regex is returned.

@param {String} `pattern`
@param {Boolean} `contains` Allow loose matching.
@param {Boolean} `isNegated` True if the pattern is a negation pattern.