function matches(subject, pattern, flags) {
    var subjectString = coerceToString(subject);
    var flagsString = coerceToString(flags);
    var patternString;

    if (!(pattern instanceof RegExp)) {
      patternString = toString(pattern);

      if (patternString === null) {
        return false;
      }

      pattern = new RegExp(patternString, flagsString);
    }

    return pattern.test(subjectString);
  }
Checks whether `subject` matches the regular expression `pattern`.

@function matches
@static
@since 1.0.0
@memberOf Query
@param {string} [subject=''] The string to verify.
@param {RegExp|string} pattern The pattern to match. If `pattern` is not RegExp, it is transformed to `new RegExp(pattern, flags)`.
@param {string} [flags=''] The regular expression flags. Applies when `pattern` is string type.
@return {boolean} Returns `true` if `subject` matches `pattern` or `false` otherwise.
@example
v.matches('pluto', /plu.{2}/);
// => true

v.matches('sun', 'S', 'i');
// => true

v.matches('apollo 11', '\\d{3}');
// => false