Checks whether the <var>target</var> text <strong>contains</strong> this
pattern or not.

@param match
A Match instance for storing matching result.
@return Offset of the start position in <VAR>target</VAR>; or -1 if not
match.
181232
public boolean matches(CharacterIterator target, Match match) {
		int start = target.getBeginIndex();
		int end = target.getEndIndex();

		synchronized (this) {
			if (this.operations == null)
				this.prepare();
			if (this.context == null)
				this.context = new Context();
		}
		Context con = null;
		synchronized (this.context) {
			con = this.context.inuse ? new Context() : this.context;
			con.reset(target, start, end, this.numberOfClosures);
		}
		if (match != null) {
			match.setNumberOfGroups(this.nofparen);
			match.setSource(target);
		} else if (this.hasBackReferences) {
			match = new Match();
			match.setNumberOfGroups(this.nofparen);
			// Need not to call setSource() because
			// a caller can not access this match instance.
		}
		con.match = match;

		if (RegularExpression.isSet(this.options, XMLSCHEMA_MODE)) {
			int matchEnd = this.match(con, this.operations, con.start, 1,
					this.options);
			// System.err.println("DEBUG: matchEnd="+matchEnd);
			if (matchEnd == con.limit) {
				if (con.match != null) {
					con.match.setBeginning(0, con.start);
					con.match.setEnd(0, matchEnd);
				}
				con.setInUse(false);
				return true;
			}
			return false;
		}

		/*
		 * The pattern has only fixed string. The engine uses Boyer-Moore.
		 */
		if (this.fixedStringOnly) {
			// System.err.println("DEBUG: fixed-only: "+this.fixedString);
			int o = this.fixedStringTable.matches(target, con.start, con.limit);
			if (o >= 0) {
				if (con.match != null) {
					con.match.setBeginning(0, o);
					con.match.setEnd(0, o + this.fixedString.length());
				}
				con.setInUse(false);
				return true;
			}
			con.setInUse(false);
			return false;
		}

		/*
		 * The pattern contains a fixed string. The engine checks with
		 * Boyer-Moore whether the text contains the fixed string or not. If
		 * not, it return with false.
		 */
		if (this.fixedString != null) {
			int o = this.fixedStringTable.matches(target, con.start, con.limit);
			if (o < 0) {
				// System.err.println("Non-match in fixed-string search.");
				con.setInUse(false);
				return false;
			}
		}

		int limit = con.limit - this.minlength;
		int matchStart;
		int matchEnd = -1;

		/*
		 * Checks whether the expression starts with ".*".
		 */
		if (this.operations != null && this.operations.type == Op.CLOSURE
				&& this.operations.getChild().type == Op.DOT) {
			if (isSet(this.options, SINGLE_LINE)) {
				matchStart = con.start;
				matchEnd = this.match(con, this.operations, con.start, 1,
						this.options);
			} else {
				boolean previousIsEOL = true;
				for (matchStart = con.start; matchStart <= limit; matchStart++) {
					int ch = target.setIndex(matchStart);
					if (isEOLChar(ch)) {
						previousIsEOL = true;
					} else {
						if (previousIsEOL) {
							if (0 <= (matchEnd = this.match(con,
									this.operations, matchStart, 1,
									this.options)))
								break;
						}
						previousIsEOL = false;
					}
				}
			}
		}

		/*
		 * Optimization against the first character.
		 */
		else if (this.firstChar != null) {
			// System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);
			RangeToken range = this.firstChar;
			for (matchStart = con.start; matchStart <= limit; matchStart++) {
				int ch = target.setIndex(matchStart);
				if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit) {
					ch = REUtil.composeFromSurrogates(ch,
							target.setIndex(matchStart + 1));
				}
				if (!range.match(ch)) {
					continue;
				}
				if (0 <= (matchEnd = this.match(con, this.operations,
						matchStart, 1, this.options))) {
					break;
				}
			}
		}

		/*
		 * Straightforward matching.
		 */
		else {
			for (matchStart = con.start; matchStart <= limit; matchStart++) {
				if (0 <= (matchEnd = this.match(con, this.operations,
						matchStart, 1, this.options)))
					break;
			}
		}

		if (matchEnd >= 0) {
			if (con.match != null) {
				con.match.setBeginning(0, matchStart);
				con.match.setEnd(0, matchEnd);
			}
			con.setInUse(false);
			return true;
		} else {
			con.setInUse(false);
			return false;
		}
	}
724599
private boolean containsNumericMatcher(String matcherExpression) {
        for (String numericMatcher : numericMatchers) {
            if (matcherExpression.contains(numericMatcher)) {
                return true;
            }
        }

        return false;
    }
1047046
public static String match(String pattern, String reg) {

        String match = null;
        List<String> matches = match(pattern, reg, 0);
        if (null != matches && matches.size() > 0) {
            match = matches.get(0);
        }
        return match;
    }
911165
public static boolean regexMatch(String input, String regex) {
        return Pattern.compile(regex).matcher(input).matches();
    }
1198391
@Nonnull
  public DescribeCommand match(@Nullable String pattern) {
    if (!"*".equals(pattern)) {
      matchOption = Optional.ofNullable(pattern);
      log.info("--match = {}", matchOption.orElse(""));
    }
    return this;
  }
218646
private boolean matchPostagRegexp(AnalyzedTokenReadings aToken, Pattern pattern) {
    for (AnalyzedToken analyzedToken : aToken) {
      String posTag = analyzedToken.getPOSTag();
      if (posTag == null) {
        posTag = "UNKNOWN";
      }
      final Matcher m = pattern.matcher(posTag);
      if (m.matches()) {
        return true;
      }
    }
    return false;
  }
668583
public T match(CharSequence text, boolean matchPrefix)
    {
        if (root == null)
        {
            throw new IllegalStateException("not compiled");
        }
        int length = text.length();
        for (int ii=0;ii<length;ii++)
        {
            switch (match(text.charAt(ii)))
            {
                case Error:
                    return null;
                case Ok:
                    if (matchPrefix)
                    {
                        T uniqueMatch = state.getUniqueMatch();
                        if (uniqueMatch != null)
                        {
                            state = root;
                            return uniqueMatch;
                        }
                    }
                    break;
                case Match:
                    return getMatched();
            }
        }
        return null;
    }
303659
public static CharMatcher is(final char match) {
    return new FastMatcher() {
      @Override public boolean matches(char c) {
        return c == match;
      }

      @Override public String replaceFrom(CharSequence sequence, char replacement) {
        return sequence.toString().replace(match, replacement);
      }

      @Override public CharMatcher and(CharMatcher other) {
        return other.matches(match) ? this : NONE;
      }

      @Override public CharMatcher or(CharMatcher other) {
        return other.matches(match) ? other : super.or(other);
      }

      @Override public CharMatcher negate() {
        return isNot(match);
      }

      @Override public String toString() {
        return "CharMatcher.is('" + showCharacter(match) + "')";
      }
    };
  }
738046
@Override
	public boolean satisfies(Match match, int... ind)
	{
		assert ind.length == 1;

		return clazz.isAssignableFrom(match.get(ind[0]).getModelInterface());
	}
1217918
function matchInteger(text, startOffset) {
    let endOffset = startOffset
    let charCode = text.charCodeAt(endOffset)
    while (charCode >= 48 && charCode <= 57) {
        endOffset++
        charCode = text.charCodeAt(endOffset)
    }

    // No match, must return null to conform with the RegExp.prototype.exec signature
    if (endOffset === startOffset) {
        return null
    } else {
        const matchedString = text.substring(startOffset, endOffset)
        // according to the RegExp.prototype.exec API the first item in the returned array must be the whole matched string.
        return [matchedString]
    }
}
1260769
public boolean find(Pattern pattern)
    {
        matcher.usePattern(pattern);
        int start = matcher.regionStart();
        if (matcher.find())
        {
            stack.add(new MatchResultImpl(matcher));
            matcher.region(matcher.end(), matcher.regionEnd());
            return true;
        }
        else
        {
            return false;
        }
    }
711547
@Override
	public boolean satisfies(Match match, int... ind)
	{
		return match.get(ind[selfIndex]) == match.get(ind[ind.length-1]) ||
			super.satisfies(match, ind);
	}
222016
public T find(String text)
    {
        T match = matcher.match(text, true);
        if (match != null)
        {
            String name = match.name();
            if (name.substring(0, Math.min(name.length(), text.length())).equalsIgnoreCase(text))
            {
                return match;
            }
        }
        return null;
    }
706295
protected boolean check(String value, String regex) {
		Pattern pattern = Pattern.compile(regex);
		return pattern.matcher(value).matches();
	}
537088
private boolean forwardMatch(String match, boolean ignoreCase, boolean resetOnTrue)
      throws
      IOException
  {
    Mark mark = reader.mark();
    List<Integer> cbuf = Lists.newArrayList();
    StringBuilder builder = new StringBuilder();

    boolean result = true;
    boolean seenChar = false;

    while (true)
    {
      cbuf.add(reader.next());

      char ch = (char) reader.curChar;

      if (reader.curChar == -1)
      {
        result = false;
        break;
      }
      else if (WHITESPACE.matches(ch))
      {
        if (seenChar)
        {
          builder.append(ch);
        }
      }
      else
      {
        if (builder.length() == 0)
        {
          seenChar = true;
        }
        builder.append(ch);
        int index = builder.length() - 1;

        if (!ignoreCase
            && (builder.charAt(index) == match.charAt(index)))
        {
          result = false;
          break;
        }

        if (ignoreCase
            && (Ascii.toLowerCase(builder.charAt(index)) != Ascii
            .toLowerCase(match.charAt(index))))
        {
          result = false;
          break;
        }
      }

      if (builder.length() == match.length())
      {
        if (!match.equalsIgnoreCase(builder.toString()))
        {
          result = false;
        }
        break;
      }
    }

    if (!result || resetOnTrue)
    {
      reader.unread(cbuf, mark);
    }

    return result;
  }
681532
@Override
    public boolean matches(TargetProperties targetConatiner, IBond targetBond) {
        if (this.smartQueryBond != null) {
            return smartQueryBond.matches(targetBond);
        } else {
            if (!isBondMatchFlag()) {
                return true;
            }
            if (isBondMatchFlag() && isBondTypeMatch(targetBond)) {
                return true;
            }
            if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetConatiner, targetBond)) {
                return true;
            }
        }
        return false;
    }
866369
public boolean matches(String string) {		
		Matcher matcher = pattern.matcher(string);
		boolean result = matcher.matches();
		return result;		
	}