protected static String orRegex(Iterable<String> elements) {
		final StringBuilder regex = new StringBuilder();
		for (final String element : elements) {
			if (regex.length() > 0) {
				regex.append("|"); //$NON-NLS-1$
			}
			regex.append("(?:"); //$NON-NLS-1$
			regex.append(quoteRegex(element));
			regex.append(")"); //$NON-NLS-1$
		}
		return regex.toString();
	}
Similar code snippets
1.
java logo
private static Pattern buildPattern(String regex) {
		if (regex == null || regex.isEmpty())
			return null;
		return Pattern.compile(regex);
	}
2.
hawkular/hawkular-apm · AbstractAnalyticsService.java
Match rating: 67.25% · See similar code snippets
java logo
protected static String createRegex(String endpoint, boolean meta) {
        StringBuilder regex = new StringBuilder();

        regex.append('^');

        for (int i=0; i < endpoint.length(); i++) {
            char ch=endpoint.charAt(i);
            if ("*".indexOf(ch) != -1) {
                regex.append('.');
            } else if ("\\.^$|?+[]{}()".indexOf(ch) != -1) {
                regex.append('\\');
            }
            regex.append(ch);
        }

        regex.append('$');

        return regex.toString();
    }
3.
rythmengine/rythmengine · CodeBuilder.java
Match rating: 65.87% · See similar code snippets
java logo
private static String toNonGeneric(String type) {
        Regex regex = new Regex("(?@<>)", "");
        return regex.replaceAll(type);
    }
4.
rythmengine/rythmengine · ParserBase.java
Match rating: 64.79% · See similar code snippets
java logo
public static Pattern pattern(String regex, Object... args) {
        if (0 < args.length) regex = String.format(regex, args);
        return Pattern.compile(regex, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
    }
5.
foundation-runtime/logging · LocalizedDateFormatPatternHelper.java
Match rating: 64.58% · See similar code snippets
java logo
final String dayPatternRegex() {
    final StringBuffer regex = new StringBuffer();
    final String pattern = this.symbols.getLocalPatternChars();
    regex.append(ANY);
    regex.append(pattern.charAt(DateFormat.DATE_FIELD));
    regex.append(OR);
    regex.append(pattern.charAt(DateFormat.DAY_OF_WEEK_FIELD));
    regex.append(OR);
    regex.append(pattern.charAt(DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD));
    regex.append(OR);
    regex.append(pattern.charAt(DateFormat.DAY_OF_YEAR_FIELD));
    regex.append(ANY);
    return regex.toString();
  }
6.
foundation-runtime/logging · LocalizedDateFormatPatternHelper.java
Match rating: 64.49% · See similar code snippets
java logo
final String amPmPatternRegex() {
    final StringBuffer regex = new StringBuffer();
    final String pattern = this.symbols.getLocalPatternChars();
    regex.append(ANY);
    regex.append(pattern.charAt(DateFormat.AM_PM_FIELD));
    regex.append(ANY);
    return regex.toString();
  }
7.
rythmengine/rythmengine · CodeBuilder.java
Match rating: 64.42% · See similar code snippets
java logo
@SuppressWarnings("unused")
    private static boolean isArray(String type) {
        Regex regex = new Regex(".*(?@[])");
        return regex.search(type);
    }
8.
foundation-runtime/logging · LocalizedDateFormatPatternHelper.java
Match rating: 64.03% · See similar code snippets
java logo
final String monthPatternRegex() {
    final StringBuffer regex = new StringBuffer();
    final String pattern = this.symbols.getLocalPatternChars();
    regex.append(ANY);
    regex.append(pattern.charAt(DateFormat.MONTH_FIELD));
    regex.append(ANY);
    return regex.toString();
  }
9.
Match rating: 63.34% · See similar code snippets
java logo
public static String disjunction(String[] patterns) {
    String regex = "";
    for (int i = 0; i < patterns.length; i++) {
      regex += patterns[i];
      if (i < patterns.length - 1) {
        regex += "|";
      }
    }
    return "(?:" + regex + ")";
  }
10.
foundation-runtime/logging · LocalizedDateFormatPatternHelper.java
Match rating: 63.32% · See similar code snippets
java logo
final String minutePatternRegex() {
    final StringBuffer regex = new StringBuffer();
    final String pattern = this.symbols.getLocalPatternChars();
    regex.append(ANY);
    regex.append(pattern.charAt(DateFormat.MINUTE_FIELD));
    regex.append(ANY);
    return regex.toString();
  }