Return true if input matches the regex
@param input
@param size
@return
@throws IOException
338538
public boolean isMatch(PushbackReader input, int size) throws IOException
    {
        InputReader reader = Input.getInstance(input, size);
        return isMatch(reader);
    }
262616
public static long toBytes(String size) {
		Matcher matcher = NUMBER_AND_UNIT.matcher(size);

		if (matcher.matches()) {
			long number = Long.parseLong(matcher.group(1));

			String unitStr = matcher.group(2);
			if (unitStr != null) {
				char unit = unitStr.toLowerCase().charAt(0);

				switch (unit) {
					case 'b':
						return number;
					case 'k':
						return number * K;
					case 'm':
						return number * M;
					case 'g':
						return number * G;
					case 't':
						return number * T;
					default:
						throw new IllegalArgumentException("unknown size unit :" + unit);
				}
			} else {
				return number;
			}
		} else {
			throw new IllegalArgumentException("malformed size string: " + size);
		}
	}
1206569
function(input) {
    return input.replace(/\{{2,}/g, function(match) {
      return match.length > 2 ? match.substr(2) : '<%=';
    }).replace(/\}{2,}/g, function(match) {
      return match.length > 2 ? match.substr(2) : '%>';
    });
  }
1327832
public void setInput(final String input)
		throws DecodingException
	{

		boolean zipFlag = input.charAt(0) == '_';
		if (zipFlag) {
			r = new BitReader(inflateInput(
					Base64.decodeBase64(input.substring(1)), 0));
		}
		else {
			byte[] data = Base64.decodeBase64(input);
			if (data == null) {

				for (int i = 0; i < input.length(); i++) {
					System.err.println(i + ": " + (int) input.charAt(i)
							+ " <> " + input.charAt(i));
				}

				throw new DecodingException("BASE 64 DECODING FAILED: " + input);
			}
			r = new BitReader(data);
		}
	}
830330
private void checkInstancesMatchRegex(@Nullable String regex) {
        if (regex != null) {
            Pattern pattern = Pattern.compile(regex);
            instances().forEach(resource -> {
                String value = (String) resource.value();
                Matcher matcher = pattern.matcher(value);
                if (!matcher.matches()) {
                    throw TransactionException.regexFailure(this, value, regex);
                }
            });
        }
    }
433306
public static Validation<String> moreThan(int size, String msg) {
        return notEmpty().and(SimpleValidation.from((s) -> s.length() >= size, format(msg, size)));
    }
841180
public static void hasLength(String input, int length, String message) {

    notNull(input, message);
    if (input.trim().length() != length) {
      throw new IllegalArgumentException(message);
    }
  }
481280
public static boolean isLong(String input) {
        try {
            Long.parseLong(input);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
890795
public static boolean matchesAny(String str, List<String> regexes) {
        return matchesAny(str, regexes, true);
    }
728363
public boolean isMatch(CharSequence text)
    {
        try
        {
            if (text.length() == 0)
            {
                return acceptEmpty;
            }
            InputReader reader = Input.getInstance(text);
            return isMatch(reader);
        }
        catch (IOException ex)
        {
            throw new IllegalArgumentException("can't happen");
        }
    }
373491
private static byte[] gzip(final InputStream input)
        throws IOException {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // @checkstyle MagicNumberCheck (1 line)
        final byte[] buf = new byte[4096];
        final OutputStream gzip = new GZIPOutputStream(baos);
        try {
            while (true) {
                final int len = input.read(buf);
                if (len < 0) {
                    break;
                }
                gzip.write(buf, 0, len);
            }
        } finally {
            gzip.close();
            input.close();
        }
        return baos.toByteArray();
    }
484532
@Override
    public MatchStrength hasFormat(InputAccessor acc) throws IOException
    {
        if (!acc.hasMoreBytes()) {
            return MatchStrength.INCONCLUSIVE;
        }
        byte b = acc.nextByte();
        // Very first thing, a UTF-8 BOM?
        if (b == UTF8_BOM_1) { // yes, looks like UTF-8 BOM
            if (!acc.hasMoreBytes()) {
                return MatchStrength.INCONCLUSIVE;
            }
            if (acc.nextByte() != UTF8_BOM_2) {
                return MatchStrength.NO_MATCH;
            }
            if (!acc.hasMoreBytes()) {
                return MatchStrength.INCONCLUSIVE;
            }
            if (acc.nextByte() != UTF8_BOM_3) {
                return MatchStrength.NO_MATCH;
            }
            if (!acc.hasMoreBytes()) {
                return MatchStrength.INCONCLUSIVE;
            }
            b = acc.nextByte();
        }
        if (b == '{' || Character.isLetter((char) b) || Character.isDigit((char) b)) {
            return MatchStrength.WEAK_MATCH;
        }
        return MatchStrength.INCONCLUSIVE;
    }
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);
            }
        }
    }
648328
private Iterable<String> validate(final String input) {
        if (optional && input.isEmpty()) return Lists.newArrayList();
        return FluentIterable
                .from(validators)
                .filter(new Predicate<Validator>() {
                    @Override
                    public boolean apply(Validator validator) {
                        try {
                            return !validator.valid(input);
                        } catch (Exception e) {
                            return true;
                        }
                    }
                })
                .transform(new Function<Validator, String>() {
                    @Override
                    public String apply(Validator input) {
                        return input.message();
                    }
                });
    }
1332178
private static boolean isMatch(List<ValueMatcher> matchers, int index, int value) {
		return (matchers.size() > index) ? matchers.get(index).match(value) : true;
	}
1311444
static boolean containsMatch(String actual, String regex) {
    return Pattern.compile(regex).matcher(actual).find();
  }
1064998
public Match matches(HString input, int startIndex) {
    //The set of states that the NFA is in
    Set<State> states = new HashSet<>();


    //Add the start state
    states.add(new State(startIndex, start));

    //All the accept states that it enters
    NavigableSet<State> accepts = new TreeSet<>();

    List<Annotation> tokens = input.tokens();


    while (!states.isEmpty()) {
      Set<State> newStates = new HashSet<>(); //states after the next consumption

      for (State s : states) {

        if (s.node.accepts()) {
          if (s.stack.isEmpty() || (s.stack.size() == 1 && s.node.consumes && s.node.name.equals(s.stack.peek()))) {
            accepts.add(s);
          }
        }

        Deque<Tuple2<String, Integer>> currentStack = s.stack;
        if (s.node.emits) {
          currentStack.push(Tuples.$(s.node.name, s.inputPosition));
        }

        for (Node n : s.node.epsilons) {
          if (s.node.consumes) {
            State next = new State(s.inputPosition, n, currentStack, s.namedGroups);
            Tuple2<String, Integer> ng = next.stack.pop();
            next.namedGroups.put(ng.getKey(), HString.union(tokens.subList(ng.v2, s.inputPosition)));
            newStates.add(next);
          }

          State next = new State(s.inputPosition, n, currentStack, s.namedGroups);
          newStates.add(next);
        }

        if (s.inputPosition >= input.tokenLength()) {
          continue;
        }

        for (Transition t : s.node.transitions) {
          int len = t.transitionFunction.matches(tokens.get(s.inputPosition));
          if (len > 0) {
            State next = new State(s.inputPosition + len, t.destination, currentStack, s.namedGroups);
            newStates.add(next);
          }
        }
      }
      states.clear();
      states = newStates;
    }

    if (accepts.isEmpty()) {
      return new Match(-1, null);
    }


    State last = accepts.last();
    int max = last.inputPosition;

    State temp = accepts.last();
    while (temp != null && temp.inputPosition >= max) {
      temp = accepts.lower(temp);
    }

    if (max == startIndex) {
      max++;
    }

    return new Match(max, last.namedGroups);
  }