function isMatchingPattern(
  value,
  pattern,
  requireExactStringMatch = false,
) {
  if (!is.isString(value)) {
    return false;
  }

  if (is.isRegExp(pattern)) {
    return pattern.test(value);
  }
  if (is.isString(pattern)) {
    return requireExactStringMatch ? value === pattern : value.includes(pattern);
  }

  return false;
}
Checks if the given value matches a regex or string

@param value The string to test
@param pattern Either a regex or a string against which `value` will be matched
@param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match
`pattern` if it contains `pattern`. Only applies to string-type patterns.