Returns true only if the value matches the regular expression
only once and exactly.

@param val	string value that may match the expression
@param regexp regular expression
@return true if val matches regular expression regexp
322051
public static boolean valueMatchesRegularExpression(String val, String regexp) {
		Pattern p = cache.get(regexp);
		if(p == null) {
			p = Pattern.compile(regexp);
			cache.put(regexp, p);
		}
		return valueMatchesRegularExpression(val, p);
	}
519919
public final boolean matches(@NotNull final String targetPath) {
        Contract.requireArgNotNull("targetPath", targetPath);
        if (regExpr == null) {
            return true;
        }
        return regExpr.matcher(targetPath).find();
    }
276732
private static boolean matches(String value, String component, Map<String, String> variableMap) {
        if (Utils.isEmpty(component)) {
            return Utils.isEmpty(value);
        }
        if (component.charAt(0) == '{') {
            // The component is a variable, so it always matches.
            if (!Utils.isEmpty(value)) {
                String varName = getVariableName(component);
                variableMap.put(varName, value);
            }
            return true;
        }
        return component.equals(value);
    }
1202027
function regexify(val) {
  if (!val) return new RegExp(/.^/);

  if (Array.isArray(val)) val = new RegExp(val.map(_lodashStringEscapeRegExp2["default"]).join("|"), "i");

  if (_lodashLangIsString2["default"](val)) {
    // normalise path separators
    val = _slash2["default"](val);

    // remove starting wildcards or relative separator if present
    if (_lodashStringStartsWith2["default"](val, "./") || _lodashStringStartsWith2["default"](val, "*/")) val = val.slice(2);
    if (_lodashStringStartsWith2["default"](val, "**/")) val = val.slice(3);

    var regex = _minimatch2["default"].makeRe(val, { nocase: true });
    return new RegExp(regex.source.slice(1, -1), "i");
  }

  if (_lodashLangIsRegExp2["default"](val)) return val;

  throw new TypeError("illegal type for regexify");
}
568381
public boolean matches(String text) {
        if (text == null) {
            return false;
        }
        if (this.regex) {
            final Pattern rx;
            if (this.caseSensitive) {
                rx = Pattern.compile(this.value);
            } else {
                rx = Pattern.compile(this.value, Pattern.CASE_INSENSITIVE);
            }
            return rx.matcher(text).matches();
        } else {
            if (this.caseSensitive) {
                return value.equals(text);
            } else {
                return value.equalsIgnoreCase(text);
            }
        }
    }
307762
public boolean containsValue(Object val) {
        synchronized( this ) {
            for( V item : values() ) {
                if( item instanceof CachedItem ){
                    CachedItem ci = (CachedItem)item;

                    if( ci.isValidForCache() && ci.equals(val) ) {
                        return true;
                    }
                }
                else if( item.equals(val) ) {
                    return true;
                }
            }
        }
        return false;
    }
431754
function pattern (val, pat) {
  if (typeof pat !== 'string') { return false }

  var match = pat.match(new RegExp('^/(.*?)/([gimy]*)$'));
  if (!match) { return false }

  return new RegExp(match[1], match[2]).test(val)
}
1270318
public boolean isValid(String value) {
        if (value == null) {
            return false;
        }
        for (Pattern pattern : patterns) {
            if (pattern.matcher(value).matches()) {
                return true;
            }
        }
        return false;
    }
866369
public boolean matches(String string) {		
		Matcher matcher = pattern.matcher(string);
		boolean result = matcher.matches();
		return result;		
	}
840307
private void buildMatch(Object val)
    {
        // create the match data
        if (val != null) {
            if (val instanceof String) {
                _match = new String[]{(String) val};
            }
            else if (val instanceof String[]) {
                String[] s = (String[]) val;
                int cnt = 0;
                for (int i = 0; i < s.length; i++) {
                    if (s[i] != null)
                        cnt++;
                }
                if (cnt == s.length)
                    _match = s;
                else {
                    if (cnt > 0) {
                        _match = new String[cnt];
                        cnt = 0;
                        for (int i = 0; i < s.length; i++) {
                            if (s[i] != null) {
                                _match[cnt++] = s[i];
                            }
                        }
                    }
                }
            }
            else {
                Iterator matchIterator = null;
                // val is never null so this would be an error
                matchIterator = IteratorFactory.createIterator(val);
                if (matchIterator == null) {
                    matchIterator = IteratorFactory.EMPTY_ITERATOR;
                }

                ArrayList matchList = new ArrayList();
                while (matchIterator.hasNext()) {
                    Object o = matchIterator.next();
                    if (o == null)
                        continue;
                    matchList.add(o);
                }

                int size = matchList.size();
                _match = new String[size];
                for (int i = 0; i < size; i++) {
                    assert (matchList.get(i) != null);
                    assert (matchList.get(i).toString() != null);
                    _match[i] = matchList.get(i).toString();
                }
            }
            if (logger.isDebugEnabled()) {
                logger.debug("****** Select Matches ******");
                if (_match != null) {
                    for (int i = 0; i < _match.length; i++) {
                        logger.debug(i + ": " + _match[i]);
                    }
                }
            }
        }
        else {
            if (_nullable && !isMultiple() && (_defaultSelections == null || _defaultSelections.size() == 0)) {
                _match = new String[]{NULL_VALUE};
            }
        }
    }
410067
function checkRegExp(test) {
  if (typeof test === 'string' && test[0] === '/') {
    var matchs = test.match(/^\/(.+)\/([igm]*)$/);
    if (matchs) {
      test = new RegExp(matchs[1], matchs[2]);
    }
  }
  return test;
}
273112
def match_check(self, regex, fun):
        '''
        
        '''
        vals = []
        if isinstance(fun, six.string_types):
            fun = [fun]
        for func in fun:
            try:
                if re.match(regex, func):
                    vals.append(True)
                else:
                    vals.append(False)
            except Exception:
                log.error('Invalid regular expression: %s', regex)
        return vals and all(vals)
1060037
function uniqueMatch(string, regexp) {
  const results = [];
  let match;

  while ((match = regexp.exec(string))) {
    results.push({
      context: match[0],
      match: match[1] || ''
    });
  }

  // Filter duplicates
  return unique(results, isEqual);
}
959373
function(value, regExp) {
      if(regExp instanceof RegExp) {
        return value.match(regExp);
      }
      var
        regExpParts = regExp.match($.fn.form.settings.regExp.flags),
        flags
      ;
      // regular expression specified as /baz/gi (flags)
      if(regExpParts) {
        regExp = (regExpParts.length >= 2)
          ? regExpParts[1]
          : regExp
        ;
        flags = (regExpParts.length >= 3)
          ? regExpParts[2]
          : ''
        ;
      }
      return value.match( new RegExp(regExp, flags) );
    }
1201521
function(val){
			val = val.toLowerCase();
			var that = this;
			$.each( CPGlobal.stringParsers, function( i, parser ) {
				var match = parser.re.exec( val ),
					values = match && parser.parse( match ),
					space = parser.space||'rgba';
				if ( values ) {
					if (space === 'hsla') {
						that.value = CPGlobal.RGBtoHSB.apply(null, CPGlobal.HSLtoRGB.apply(null, values));
					} else {
						that.value = CPGlobal.RGBtoHSB.apply(null, values);
					}
					return false;
				}
			});
		}
912622
private boolean matchLemmaRegexp(AnalyzedTokenReadings aToken,
      Pattern pattern) {
    boolean matches = false;
    for (AnalyzedToken analyzedToken : aToken) {
      final String posTag = analyzedToken.getLemma();
      if (posTag != null) {
        final Matcher m = pattern.matcher(posTag);
        if (m.matches()) {
          matches = true;
          break;
        }
      }
    }
    return matches;
  }
1020863
public static boolean validateRegex(String value, String regex, boolean allowEmpty) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
            return allowEmpty;
        }
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(value);
        return matcher.matches();
    }