Appends the specified matching pattern.

@param   pattern
the matching pattern to be appended.
@throws  IllegalArgumentPointerException
if the specified pattern is null.
171584
public FulltextMatch addPattern(
                    final String pattern
                    )
    {
        if (pattern == null  ||  pattern.length() == 0) {
            throw new IllegalArgumentException( "no pattern specified" );
        }

        _patterns.add( pattern );

        return this;
    }
1316751
private String matchPatternInBuffer(Pattern pattern) {
        matchValid = false;
        matcher.usePattern(pattern);
        matcher.region(position, buf.limit());
        if (matcher.lookingAt()) {
            if (matcher.hitEnd() && (!sourceClosed)) {
                // Get more input and try again
                needInput = true;
                return null;
            }
            position = matcher.end();
            return matcher.group();
        }

        if (sourceClosed)
            return null;

        // Read more to find pattern
        needInput = true;
        return null;
    }
418961
def append(self, pattern):
        """"""
        assert isinstance(pattern, Pattern)
        self.patterns.append(pattern)
        if self._all_files is not None:
            self._all_files = self._all_files or pattern.all_files()
471737
private String fillPattern(String pattern, String[] parameters) {
        boolean containsSingleQuote = false;
        boolean containsDoubleQuote = false;
        Object[] escapedParams = new Object[parameters.length];
        for (int i = 0; i < parameters.length; i++) {
            String param = parameters[i];
            containsSingleQuote = containsSingleQuote || param.contains("'");
            containsDoubleQuote = containsDoubleQuote || param.contains("\"");
            escapedParams[i] = param;
        }
        if (containsDoubleQuote && containsSingleQuote) {
            throw new RuntimeException("Unsupported combination of single and double quotes");
        }
        String patternToUse;
        if (containsSingleQuote) {
            patternToUse = SINGLE_QUOTE_PATTERN.matcher(pattern).replaceAll("\"");
        } else {
            patternToUse = pattern;
        }
        return String.format(patternToUse, escapedParams);
    }
790635
public Appender parse( String pattern ) throws IllegalArgumentException
	{
		List<Appender> appenders = new ArrayList<Appender>();
		int prev = 0;
		int pos = 0;
		while ((pos = pattern.indexOf(VAR_START, pos)) >= 0)
		{
			// Add text between beginning/end of last variable
			if ( pos > prev )
			{
				appenders.add(new TextAppender(pattern.substring(prev, pos)));
			}

			// Move to real variable name beginning
			pos += VAR_START_LEN;

			// Next close bracket (not necessarily the variable end bracket if
			// there is a default value with nested variables
			int endVariable = pattern.indexOf(VAR_CLOSE, pos);
			if ( endVariable < 0 )
			{
				throw new IllegalArgumentException(format(
						"Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''", pattern,
						VAR_CLOSE, pos - VAR_START_LEN, pattern.substring(pos - VAR_START_LEN)));
			}

			// Try to skip eventual internal variable here
			int nextVariable = pattern.indexOf(VAR_START, pos);
			// Just used to throw exception with more accurate message
			int lastEndVariable = endVariable;
			boolean hasNested = false;
			while (nextVariable >= 0 && nextVariable < endVariable)
			{
				hasNested = true;
				endVariable = pattern.indexOf(VAR_CLOSE, endVariable + VAR_CLOSE_LEN);
				// Something is badly closed
				if ( endVariable < 0 )
				{
					throw new IllegalArgumentException(format(
							"Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''",
							pattern, VAR_CLOSE, nextVariable, pattern.substring(nextVariable, lastEndVariable)));
				}
				nextVariable = pattern.indexOf(VAR_START, nextVariable + VAR_START_LEN);
				lastEndVariable = endVariable;
			}
			// The chunk to process
			final String rawKey = pattern.substring(pos - VAR_START_LEN, endVariable + VAR_CLOSE_LEN);
			// Key without variable start and end symbols
			final String key = pattern.substring(pos, endVariable);

			int pipeIndex = key.indexOf(PIPE_SEPARATOR);

			boolean hasKeyVariables = false;
			boolean hasDefault = false;
			boolean hasDefaultVariables = false;

			// There is a pipe
			if ( pipeIndex >= 0 )
			{
				// No nested property detected, simple default part
				if ( !hasNested )
				{
					hasDefault = true;
					hasDefaultVariables = false;
				}
				// There is a pipe and nested variable,
				// determine if pipe is for the current variable or a nested key
				// variable
				else
				{
					int nextStartKeyVariable = key.indexOf(VAR_START);
					hasKeyVariables = pipeIndex > nextStartKeyVariable;
					if ( hasKeyVariables )
					{
						// ff${fdf}|${f}
						int nextEndKeyVariable = key.indexOf(VAR_CLOSE, nextStartKeyVariable + VAR_START_LEN);
						pipeIndex = key.indexOf(PIPE_SEPARATOR, nextEndKeyVariable + VAR_CLOSE_LEN);
						while (pipeIndex >= 0 && pipeIndex > nextStartKeyVariable)
						{
							pipeIndex = key.indexOf(PIPE_SEPARATOR, nextEndKeyVariable + VAR_CLOSE_LEN);
							nextStartKeyVariable = key.indexOf(VAR_START, nextStartKeyVariable + VAR_START_LEN);
							// No more nested variable
							if ( nextStartKeyVariable < 0 )
							{
								break;
							}
							nextEndKeyVariable = key.indexOf(VAR_CLOSE, nextEndKeyVariable + VAR_CLOSE_LEN);
							if ( nextEndKeyVariable < 0 )
							{
								throw new IllegalArgumentException(
										format("Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''",
												pattern, VAR_CLOSE, nextStartKeyVariable, key.substring(nextStartKeyVariable)));
							}
						}
					}

					// nested variables are only for key, current variable does
					// not have a default value
					if ( pipeIndex >= 0 )
					{
						hasDefault = true;
						hasDefaultVariables = key.indexOf(VAR_START, pipeIndex) >= 0;
					}

				}
			}
			// No pipe, there is key variables if nested elements have been
			// detected
			else
			{
				hasKeyVariables = hasNested;
			}

			// Construct variable appenders
			String keyPart = null;
			String defaultPart = null;
			if ( hasDefault )
			{
				keyPart = key.substring(0, pipeIndex).trim();
				defaultPart = key.substring(pipeIndex + PIPE_SEPARATOR_LEN).trim();
			} else
			{
				keyPart = key.trim();
			}
			// Choose TextAppender when relevant to avoid unecessary parsing when it's clearly not needed
			appenders.add(new KeyAppender(this, rawKey, hasKeyVariables ? parse(keyPart) : new TextAppender(keyPart), !hasDefault ? null
					: (hasDefaultVariables ? parse(defaultPart) : new TextAppender(defaultPart))));

			prev = endVariable + VAR_CLOSE_LEN;
			pos = prev;
		}

		if ( prev < pattern.length() )
		{
			appenders.add(new TextAppender(pattern.substring(prev)));
		}

		return appenders.size() == 1 ? appenders.get(0) : new MixinAppender(pattern, appenders);
	}
109893
private void addIntervalFallback(MethodSpec.Builder method, String pattern) {
    method.addComment("$S", pattern);
    for (Node node : WRAPPER_PARSER.parseWrapper(pattern)) {
      if (node instanceof Text) {
        method.addStatement("b.append($S)", ((Text)node).text());

      } else if (node instanceof Field) {
        Field field = (Field)node;
        String which = "s";
        if (field.ch() == '1') {
          which = "e";
        }
        method.addStatement("formatSkeleton(k, $L, b)", which);
      }
    }
  }
1280621
public static CharSequence matchesPattern(final CharSequence input, final String pattern, final String message) {
        return INSTANCE.matchesPattern(input, pattern, message);
    }
1124268
@Configurable
  public void addArg(String arg)
  {
    if (_args == null)
      _args = new ArrayList<String>();
    
    _args.add(arg);
  }
1251533
public static String formatFallback(final String pattern, final Object... arguments) {
		StringBuilder sb = new StringBuilder(pattern);
		for (Object argument : arguments) {
			sb.append(", ");
			sb.append(argument);
		}
		return sb.toString();
	}
1098653
public static boolean isValidPattern(String pattern) {
    if (pattern == null) {
      return false;
    }
    String canon = pattern.replace('/', '.');
    return ClassName.isQualifiedName(canon)
        || ClassName.isStarQualifiedName(canon);
  }
390351
public static boolean startsWithPattern(
      final byte[] byteArray,
      final byte[] pattern) {
    Preconditions.checkNotNull(byteArray);
    Preconditions.checkNotNull(pattern);
    if (pattern.length > byteArray.length) {
      return false;
    }

    for (int i = 0; i < pattern.length; ++i) {
      if (byteArray[i] != pattern[i]) {
        return false;
      }
    }

    return true;
  }
1068214
public static Pattern and(final Pattern... patterns) {
    return new Pattern() {
      @Override public int match(CharSequence src, int begin, int end) {
        int ret = 0;
        for (Pattern pattern : patterns) {
          int l = pattern.match(src, begin, end);
          if (l == MISMATCH) return MISMATCH;
          if (l > ret) ret = l;
        }
        return ret;
      }

      @Override public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append('(');
        for (Pattern pattern : patterns) {
          sb.append(pattern).append(" & ");
        }
        if (sb.length() > 1) {
          sb.delete(sb.length() - 3, sb.length());
        }
        return sb.append(')').toString();
      }
    };
  }
956454
public final void setRegex(@NonNull final Pattern regex) {
        Condition.INSTANCE.ensureNotNull(regex, "The regular expression may not be null");
        this.regex = regex;
    }
565434
public void writeRegex(Pattern pattern) throws IOException {
		_writeArrayFieldNameIfNeeded();
		_verifyValueWrite("write regex");
		_buffer.putByte(_typeMarker, BsonConstants.TYPE_REGEX);
		_writeCString(pattern.pattern());
		_writeCString(flagsToRegexOptions(pattern.flags()));
		flushBuffer();
	}
145016
public static void appendToRule(StringBuffer rule,
                                    UnicodeMatcher matcher,
                                    boolean escapeUnprintable,
                                    StringBuffer quoteBuf) {
        if (matcher != null) {
            appendToRule(rule, matcher.toPattern(escapeUnprintable),
                         true, escapeUnprintable, quoteBuf);
        }
    }
92614
public SortArgs get(String pattern) {

        LettuceAssert.notNull(pattern, "Pattern must not be null");

        if (get == null) {
            get = new ArrayList<>();
        }
        get.add(pattern);
        return this;
    }
901396
public static Pattern compile(String pattern) throws IllegalArgumentException {
        if (pattern == null) {
            throw new IllegalArgumentException("Pattern can not be null");
        }

        if (pattern.startsWith("/") && pattern.endsWith("/") && pattern.length() > 1) {
            // This is a regular expression
            // So create matcher as is
            try {
                return Pattern.compile(pattern.substring(1, pattern.length() - 1));
            } catch (PatternSyntaxException e) {
                throw new IllegalArgumentException("Pattern contains an invalid expression", e);
            }
        }

        StringBuilder rEPattern = new StringBuilder("^");

        for (int i = 0; i < pattern.length(); i++) {
            if (pattern.charAt(i) == '*')
                rEPattern.append('.');
            if (pattern.charAt(i) == '?') {
                rEPattern.append('.');
            } else {
                rEPattern.append(pattern.charAt(i));
            }
        }

        rEPattern.append("$");

        try {
            return Pattern.compile(rEPattern.toString());
        } catch (PatternSyntaxException e) {
            throw new IllegalArgumentException("Pattern contains an invalid expression", e);
        }
    }