Impetus/Kundera · MongoDBQuery.java
java logo
public static String createLikeRegex(String expr, boolean ignoreCase)
    {
        String regex = createRegex(expr, ignoreCase);
        regex = regex.replace("_", ".").replace("%", ".*?");

        return regex;
    }
Similar code snippets
1.
galenframework/galen · GalenUtils.java
Match rating: 63.04% · See similar code snippets
java logo
public static Pattern convertObjectNameRegex(String regex) {
        String jRegex = regex.replace("#", "[0-9]+").replace("*", ".*");
        return Pattern.compile(jRegex);
    }
2.
wildfly/wildfly-core · Util.java
Match rating: 61.98% · See similar code snippets
java logo
public static String wildcardToJavaRegex(String expr) {
        if(expr == null) {
            throw new IllegalArgumentException("expr is null");
        }
        String regex = expr.replaceAll("([(){}\\[\\].+^$])", "\\\\$1"); // escape regex characters
        regex = regex.replaceAll("\\*", ".*"); // replace * with .*
        regex = regex.replaceAll("\\?", "."); // replace ? with .
        return regex;
    }
3.
fedups/com.obdobion.argument · WildPath.java
Match rating: 61.77% · See similar code snippets
java logo
public static Pattern convertFileWildCardToRegx(final String wildcard)
    {
        String regex = wildcard;
        regex = regex.replaceAll("[.]", "\\\\.");
        regex = regex.replaceAll("[?]", ".");
        regex = regex.replaceAll("[*]", ".*");
        return Pattern.compile("^" + regex + "$", Pattern.CASE_INSENSITIVE);
    }
4.
wildfly/wildfly-build-tools · ParsingUtils.java
Match rating: 61.55% · See similar code snippets
java logo
public static String wildcardToJavaRegexp(String expr) {
        if (expr == null) {
            throw new IllegalArgumentException("expr is null");
        }
        String regex = expr.replaceAll("([(){}\\[\\].+^$])", "\\\\$1"); // escape regex characters
        regex = regex.replaceAll("\\*", ".*"); // replace * with .*
        regex = regex.replaceAll("\\?", "."); // replace ? with .
        return regex;
    }
5.
seedstack/seed · ProxyManager.java
Match rating: 59.93% · See similar code snippets
java logo
private Pattern makePattern(String noProxy) {
        String regex = noProxy.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*");
        if (!regex.startsWith(".*")) {
            regex = ".*" + regex;
        }
        regex = "^" + regex + "$";
        return Pattern.compile(regex);
    }
6.
webmetrics/browsermob-proxy · UASparser.java
Match rating: 59.7% · 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;
	}
7.
whitesource/agents · RegexUtils.java
Match rating: 59.36% · See similar code snippets
java logo
public static String toJava(String regex) {
        if (StringUtils.isBlank(regex)) {
            return regex;
        } else {
            return regex.replaceAll("\\.", "\\\\.")
                    .replaceAll("\\*",".*");
        }
    }
8.
fedups/com.obdobion.argument · WildPath.java
Match rating: 59.19% · See similar code snippets
java logo
static Pattern convertDirWildCardToRegx(final String wildcard)
    {
        if (wildcard == null || wildcard.length() == 0)
            return Pattern.compile("\\.");

        String regex;
        regex = wildcard;

        regex = regex.replaceAll("\\\\", "\\\\\\\\");
        regex = regex.replaceAll("[.]", "\\\\.");
        regex = regex.replaceAll("[?]", ".");
        regex = regex.replaceAll("\\*\\*", ".`");
        regex = regex.replaceAll("[*]", "[^\\\\\\\\]*");
        regex = regex.replaceAll("`", "*");

        return Pattern.compile("^" + regex + "$", Pattern.CASE_INSENSITIVE);
    }
9.
rythmengine/rythmengine · CodeBuilder.java
Match rating: 58.29% · See similar code snippets
java logo
private static String toNonGeneric(String type) {
        Regex regex = new Regex("(?@<>)", "");
        return regex.replaceAll(type);
    }
10.
rythmengine/rythmengine · CodeBuilder.java
Match rating: 58.16% · See similar code snippets
java logo
@SuppressWarnings("unused")
    private static boolean isArray(String type) {
        Regex regex = new Regex(".*(?@[])");
        return regex.search(type);
    }