Creates an instance of an unsuccessful match.
@param input the input string.
@param canStopMatching indicates whether matching operation can be stopped.
@return the result object.
342856
public static Result failure(String input, boolean canStopMatching) {
        return new SimpleResult(false, input, null, null, canStopMatching);
    }
66296
private static boolean match(String regExp, String userInput) {
        Pattern pattern = Pattern.compile(regExp);
        Matcher matcher = pattern.matcher(userInput);
        if (matcher.find())
            return true;
        else
            return false;
    }
643394
public char match(ISense source, ISense target) {
        String sSynset = source.getGloss();
        String tSynset = target.getGloss();
        StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();");
        String lemmaS, lemmaT;
        int counter = 0;
        while (stSource.hasMoreTokens()) {
            StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();");
            lemmaS = stSource.nextToken();
            if (!meaninglessWords.contains(lemmaS))
                while (stTarget.hasMoreTokens()) {
                    lemmaT = stTarget.nextToken();
                    if (!meaninglessWords.contains(lemmaT))
                        if (lemmaS.equals(lemmaT))
                            counter++;
                }
        }
        if (counter >= threshold)
            return IMappingElement.EQUIVALENCE;
        else
            return IMappingElement.IDK;
    }
737890
private void buildMatch(Object val)
    {
        if (val instanceof String[]) {
            _match = (String[]) val;
        }
        else {
            Iterator matchIterator = null;
            // this should return null, but we should handle it it does
            matchIterator = IteratorFactory.createIterator(val);
            if (matchIterator == null)
                matchIterator = IteratorFactory.EMPTY_ITERATOR;

            List matchList = new ArrayList();
            while (matchIterator.hasNext()) {
                Object o = matchIterator.next();
                if (o != null)
                    matchList.add(o.toString());
            }
            int size = matchList.size();

            _match = new String[size];
            for (int i = 0; i < size; i++) {
                _match[i] = matchList.get(i).toString();
            }
        }

        if (logger.isDebugEnabled()) {
            logger.debug("****** CheckboxGroup Matches ******");
            if (_match != null) {
                for (int i = 0; i < _match.length; i++) {
                    logger.debug(i + ": " + _match[i]);
                }
            }
        }
    }
317947
@Override
    public boolean isValid(Object input) {
        String str = input.toString();
        int len = str.length();
        if (minLength != null && len < minLength)
            return false;
        if (maxLength != null && len > maxLength)
            return false;

        return regex == null || str.matches(regex);
    }
840416
public char match(ISense source1, ISense target1) throws MatcherLibraryException {
        char result = IMappingElement.IDK;
        try {
            String tExtendedGloss = getExtendedGloss(target1, 1, IMappingElement.LESS_GENERAL);
            String sExtendedGloss = getExtendedGloss(source1, 1, IMappingElement.LESS_GENERAL);
            //variations of this matcher
            StringTokenizer stSource = new StringTokenizer(tExtendedGloss, " ,.\"'();");
            String lemmaS, lemmaT;
            int counter = 0;
            while (stSource.hasMoreTokens()) {
                StringTokenizer stTarget = new StringTokenizer(sExtendedGloss, " ,.\"'();");
                lemmaS = stSource.nextToken();
                if (!meaninglessWords.contains(lemmaS))
                    while (stTarget.hasMoreTokens()) {
                        lemmaT = stTarget.nextToken();
                        if (!meaninglessWords.contains(lemmaT))
                            if (lemmaS.equalsIgnoreCase(lemmaT))
                                counter++;
                    }
            }
            if (counter > threshold) {
                result = IMappingElement.EQUIVALENCE;
            }
        } catch (LinguisticOracleException e) {
            final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
            log.error(errMessage, e);
            throw new MatcherLibraryException(errMessage, e);
        }
        return result;
    }
1099377
public static int match_main(String text, String pattern, int loc) {
        // Check for null inputs.
        if (text == null || pattern == null) {
            throw new IllegalArgumentException("Null inputs. (match_main)");
        }

        loc = Math.max(0, Math.min(loc, text.length()));
        if (text.equals(pattern)) {
            // Shortcut (potentially not guaranteed by the algorithm)
            return 0;
        } else if (text.length() == 0) {
            // Nothing to match.
            return -1;
        } else if (loc + pattern.length() <= text.length()
                && text.substring(loc, loc + pattern.length()).equals(pattern)) {
            // Perfect match at the perfect spot! (Includes case of null
            // pattern)
            return loc;
        } else {
            // Do a fuzzy compare.
            return match_bitap(text, pattern, loc);
        }
    }
603754
public static Matcher<Object> hasSingleFailureContaining(final String string) {
        return new BaseMatcher<Object>() {
            public boolean matches(Object item) {
                return item.toString().contains(string) && failureCountIs(1).matches(item);
            }

            public void describeTo(Description description) {
                description.appendText("has single failure containing " + string);
            }
        };
    }
542337
public static CharMatcher isNot(final char match) {
    return new FastMatcher() {
      @Override public boolean matches(char c) {
        return c != match;
      }

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

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

      @GwtIncompatible("java.util.BitSet")
      @Override
      void setBits(BitSet table) {
        table.set(0, match);
        table.set(match + 1, Character.MAX_VALUE + 1);
      }

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

      @Override public String toString() {
        return "CharMatcher.isNot('" + showCharacter(match) + "')";
      }
    };
  }
1198391
@Nonnull
  public DescribeCommand match(@Nullable String pattern) {
    if (!"*".equals(pattern)) {
      matchOption = Optional.ofNullable(pattern);
      log.info("--match = {}", matchOption.orElse(""));
    }
    return this;
  }
876790
function match(input, patterns = []){
	if(!patterns || 0 === patterns.length)
		return false;
	
	input    = String(input);
	patterns = arrayify(patterns).filter(Boolean);
	for(const pattern of patterns)
		if((pattern === input && "string" === typeof pattern)
		|| (pattern instanceof RegExp) && pattern.test(input))
			return true;
	return false;
}
150581
protected static Pattern makePattern (String input)
    {
        StringBuilder pattern = new StringBuilder('^');

        while (true) {
            String[] parts = _splitter.split(input, 2);
            pattern.append(Pattern.quote(parts[0]));
            if (parts.length == 1) {
                break;
            }
            int length = parts[0].length();
            String wildcard = input.substring(length, length + 1);
            if (wildcard.equals("*")) {
                pattern.append(".*");
            } else {
                System.err.println("Bad wildcard " + wildcard);
            }
            input = parts[1];
        }

        pattern.append("$");
        return Pattern.compile(pattern.toString());
    }
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};
            }
        }
    }
1041734
private Optional<Data<Input, Output>> match_(Input input) {
        return Optional.ofNullable(recent_.get())
                .filter((Data<Input, Output> data) -> equality_.test(data.getInput(), input));
    }
811955
protected EofMatch findEof(Match matches[]) {
        EofMatch ourEof = null;
        for (int i = 0; i < matches.length; i++) {
            if (matches[i] instanceof EofMatch)
                ourEof = (EofMatch) matches[i];
        }

        if (ourEof == null) {
            // Have to create our own
            ourEof = new EofMatch();
        }

        return ourEof;
    }
703517
@Nullable
  protected List<Match> addLegacyMatches(List <Match> existingSugMatches, String messageStr,
      boolean inMessage) {
    List<Match> sugMatch = new ArrayList<>();
    int pos = 0;
    int ind = 0;
    int matchCounter = 0;
    while (pos != -1) {
      pos = messageStr.indexOf('\\', ind);
      if (pos != -1 && messageStr.length() > pos && Character.isDigit(messageStr.charAt(pos + 1))) {
        if (pos == 0 || messageStr.charAt(pos - 1) != '\u0001') {
          Match mWorker = new Match(null, null, false, null,
              null, Match.CaseConversion.NONE, false, false, Match.IncludeRange.NONE);
          mWorker.setInMessageOnly(true);
          sugMatch.add(mWorker);
        } else if (messageStr.charAt(pos - 1) == '\u0001') { // real suggestion marker
          sugMatch.add(existingSugMatches.get(matchCounter));
          if (inMessage) {
            message.deleteCharAt(pos - 1 - matchCounter);
          } else {
            suggestionsOutMsg.deleteCharAt(pos - 1 - matchCounter);
          }
          matchCounter++;
        }
      }
      ind = pos + 1;
    }

    if (sugMatch.isEmpty()) {
      return existingSugMatches;
    }
    return sugMatch;
  }
546118
@Override
    public Status match(int cc)
    {
        int highest = -1;
        Iterator<Matcher> iterator = active.iterator();
        while (iterator.hasNext())
        {
            Matcher matcher = iterator.next();
            Status s = matcher.match(cc);
            highest = Math.max(highest, s.ordinal());
            switch (s)
            {
                case Match:
                    lastMatched = matcher;
                    clear();
                    return s;
                case WillMatch:
                    lastMatched = matcher;
                    return s;
                case Error:
                    iterator.remove();
                    break;
            }
        }
        if (active.isEmpty())
        {
            clear();
            return Status.Error;
        }
        return Status.values()[highest];
    }