Split string content into list, ignoring matches of the pattern
@param content String content
@param ignorePattern Pattern to ignore
@return list
540447
public static List<String> asListLinesIgnore(String content, Pattern ignorePattern) {
    List<String> retorno = new ArrayList<String>();
    content = content.replace(CARRIAGE_RETURN, RETURN);
    content = content.replace(RETURN, CARRIAGE_RETURN);
    for (String str : content.split(CARRIAGE_RETURN)) {
      if (!ignorePattern.matcher(str).matches()) {
        retorno.add(str);
      }
    }
    return retorno;
  }
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);
    }
1368126
public static Matcher<String> containsPatterns(String... patterns) {
        List<Matcher<? super String>> matchers = new ArrayList<Matcher<? super String>>();
        for (String pattern : patterns) {
            matchers.add(pattern(pattern));
        }
        return allOf(matchers);
    }
1208202
function parsePattern(pattern) {
	var regexSpecialChars = /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g;
	// Treat consecutive wildcards as one (#12)
	var wildCardPattern = /\*+/g;
	var endOfLinePattern = /\\\$$/;

	pattern = normaliseEncoding(pattern)

	if (pattern.indexOf('*') < 0 && pattern.indexOf('$') < 0) {
		return pattern;
	}

	pattern = pattern
		.replace(regexSpecialChars, '\\$&')
		.replace(wildCardPattern, '(?:.*)')
		.replace(endOfLinePattern, '$');

	return new RegExp(pattern);
}
104530
public static String delPre(String regex, CharSequence content) {
		if (null == content || null == regex) {
			return StrUtil.str(content);
		}

		// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
		final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
		Matcher matcher = pattern.matcher(content);
		if (matcher.find()) {
			return StrUtil.sub(content, matcher.end(), content.length());
		}
		return StrUtil.str(content);
	}
325624
public static String stringMatcherByPattern(String input, String patternStr) {

        String output = PcConstants.SYSTEM_FAIL_MATCH_REGEX;

        // 20140105: fix the NPE issue
        if (patternStr == null) {
            logger.error("patternStr is NULL! (Expected when the aggregation rule is not defined at "
                    + PcDateUtils.getNowDateTimeStrStandard());
            return output;
        }

        if (input == null) {
            logger.error("input (Expected when the response is null and now try to match on response) is NULL in stringMatcherByPattern() at "
                    + PcDateUtils.getNowDateTimeStrStandard());
            return output;
        } else {
            input = input.replace("\n", "").replace("\r", "");
        }

        logger.debug("input: " + input);
        logger.debug("patternStr: " + patternStr);

        Pattern patternMetric = Pattern.compile(patternStr, Pattern.MULTILINE);

        final Matcher matcher = patternMetric.matcher(input);
        if (matcher.matches()) {
            output = matcher.group(1);
        }
        return output;
    }
79538
public HString findPattern(@NonNull Pattern regex) {
      Matcher m = matcher(regex);
      if (m.find()) {
         return union(substring(m.start(), m.end()).tokens());
      }
      return Fragments.empty(document());
   }
10555
public static Token parse(final String pattern) {
		List<Token> tokens = new ArrayList<Token>();

		int start = 0;
		int count = 0;

		for (int i = 0; i < pattern.length(); ++i) {
			char character = pattern.charAt(i);

			if (character == '{') {
				if (count == 0) {
					if (start < i) {
						tokens.add(new PlainTextToken(pattern.substring(start, i)));
					}
					start = i;
				}
				count += 1;
			} else if (character == '}') {
				if (count == 0) {
					InternalLogger.log(Level.ERROR, "Opening curly bracket is missing: '" + pattern + "'");
				} else {
					count -= 1;
					if (count == 0) {
						tokens.add(parse(pattern.substring(start + 1, i)));
						start = i + 1;
					}
				}
			}
		}

		if (count > 0) {
			InternalLogger.log(Level.ERROR, "Closing curly bracket is missing: '" + pattern + "'");
		}

		int splitIndex = pattern.indexOf('|', start);
		if (splitIndex == -1) {
			tokens.add(createPlainToken(pattern.substring(start)));
			return tokens.size() == 1 ? tokens.get(0) : new BundleToken(tokens);
		} else {
			String token = pattern.substring(start, splitIndex).trim();
			tokens.add(createPlainToken(token));
			String[] styleOptions = SPLIT_PATTERN.split(pattern.substring(splitIndex + 1));
			return styleToken(tokens.size() == 1 ? tokens.get(0) : new BundleToken(tokens), styleOptions);
		}
	}
923209
public static String get(Pattern pattern, CharSequence content, int groupIndex) {
		if (null == content || null == pattern) {
			return null;
		}

		final Matcher matcher = pattern.matcher(content);
		if (matcher.find()) {
			return matcher.group(groupIndex);
		}
		return null;
	}
1019412
public static List<String> findAllGroup0(Pattern pattern, CharSequence content) {
		return findAll(pattern, content, 0);
	}
1028727
function matchPatternOrExact(patternStrings, candidate) {
        var patterns = [];
        for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) {
            var patternString = patternStrings_1[_i];
            var pattern = tryParsePattern(patternString);
            if (pattern) {
                patterns.push(pattern);
            }
            else if (patternString === candidate) {
                // pattern was matched as is - no need to search further
                return patternString;
            }
        }
        return findBestPatternMatch(patterns, function (_) { return _; }, candidate);
    }
379187
private void parseGroupPattern(String groupPattern) {
		List<String> patternList = StrUtil.split(groupPattern, '|');
		for (String pattern : patternList) {
			parseSinglePattern(pattern);
		}
	}
1168107
private static boolean matchesPatternList(final String str, final List<Pattern> patterns) {
        if (patterns != null) {
            for (final Pattern pattern : patterns) {
                if (pattern.matcher(str).matches()) {
                    return true;
                }
            }
        }
        return false;
    }
787884
public static boolean contains(Pattern pattern, CharSequence content) {
		if (null == pattern || null == content) {
			return false;
		}
		return pattern.matcher(content).find();
	}
1055176
public static boolean isMatch(String regex, CharSequence content) {
		if (content == null) {
			// 提供null的字符串为不匹配
			return false;
		}

		if (StrUtil.isEmpty(regex)) {
			// 正则不存在则为全匹配
			return true;
		}

		// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
		final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
		return isMatch(pattern, content);
	}
834179
public static String delFirst(Pattern pattern, CharSequence content) {
		if (null == pattern || StrUtil.isBlank(content)) {
			return StrUtil.str(content);
		}

		return pattern.matcher(content).replaceFirst(StrUtil.EMPTY);
	}
693385
public static PatternMatcher compile(String pattern) {
    String p = pattern;
    boolean ignoreCase = false;
    if (p.startsWith("(?i)")) {
      ignoreCase = true;
      p = pattern.substring(4);
    }
    if (p.length() > 0) {
      p = "^.*(" + p + ").*$";
    }
    Parser parser = new Parser(PatternUtils.expandEscapedChars(p));
    Matcher m = Optimizer.optimize(parser.parse());
    return ignoreCase ? m.ignoreCase() : m;
  }