poetix/navn · Name.java
java logo
public static Name of(String source, String regex) {
        return of(source, s -> s.split(regex));
    }
Similar code snippets
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();
	}
2.
Netflix/spectator · TagMeasurementFilter.java
Match rating: 58.66% · See similar code snippets
java logo
private static Pattern regexToPatternOrNull(String regex) {
    if (regex != null && !regex.isEmpty() && !regex.equals(".*")) {
      return Pattern.compile(regex);
    }
    return null;
  }
3.
webmetrics/browsermob-proxy · UASparser.java
Match rating: 58.11% · See similar code snippets
java logo
private String convertPerlToJavaRegex(String regex) {
		regex = regex.substring(1);
		int lastIndex = regex.lastIndexOf('/');
		regex = regex.substring(0, lastIndex);
		return regex;
	}
4.
java logo
private static Pattern buildPattern(String regex) {
		if (regex == null || regex.isEmpty())
			return null;
		return Pattern.compile(regex);
	}
5.
rythmengine/rythmengine · CodeBuilder.java
Match rating: 56.19% · See similar code snippets
java logo
@SuppressWarnings("unused")
    private static boolean isArray(String type) {
        Regex regex = new Regex(".*(?@[])");
        return regex.search(type);
    }
6.
rythmengine/rythmengine · CodeBuilder.java
Match rating: 56.14% · See similar code snippets
java logo
private static String toNonGeneric(String type) {
        Regex regex = new Regex("(?@<>)", "");
        return regex.replaceAll(type);
    }
7.
OpenTSDB/opentsdb · TreeRule.java
Match rating: 55.07% · See similar code snippets
java logo
public void setRegex(String regex) {
    if (!this.regex.equals(regex)) {
      changed.put("regex", true);
      this.regex = regex;
      if (regex != null && !regex.isEmpty()) {
        this.compiled_regex = Pattern.compile(regex);
      } else {
        this.compiled_regex = null;
      }
    }
  }
8.
Chorus-bdd/Chorus · ConfigPropertyUtils.java
Match rating: 55.0% · See similar code snippets
java logo
public static <T extends Enum<T>> Pattern createValidationPatternFromEnumType(Class<T> enumType) {

        String regEx = Stream.of(enumType.getEnumConstants())
                .map(Enum::name)
                .collect(Collectors.joining("|", "(?i)", ""));

        //Enum constants may contain $ which needs to be escaped
        regEx = regEx.replace("$", "\\$");
        return Pattern.compile(regEx);
    }
9.
landawn/AbacusUtil · StringUtil.java
Match rating: 54.86% · See similar code snippets
java logo
public static String replacePattern(final String source, final String regex, final String replacement) {
        return Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(replacement);
    }
10.
GojaFramework/goja · Validator.java
Match rating: 54.8% · See similar code snippets
java logo
public static boolean match(String regex, String value) {
        Pattern pattern = Pattern.compile(regex);
        return pattern.matcher(value).find();
    }