public Optional<Boolean> match(String user, String property)
    {
        if (userRegex.map(regex -> regex.matcher(user).matches()).orElse(true) &&
                propertyRegex.map(regex -> regex.matcher(property).matches()).orElse(true)) {
            return Optional.of(allow);
        }
        return Optional.empty();
    }
Similar code snippets
1.
Match rating: 78.18% · See similar code snippets
java logo
public Optional<Boolean> match(String user, String schema)
    {
        if (userRegex.map(regex -> regex.matcher(user).matches()).orElse(true) &&
                schemaRegex.map(regex -> regex.matcher(schema).matches()).orElse(true)) {
            return Optional.of(owner);
        }
        return Optional.empty();
    }
2.
Match rating: 73.01% · See similar code snippets
java logo
public Optional<Boolean> match(String user, String catalog)
    {
        if (userRegex.map(regex -> regex.matcher(user).matches()).orElse(true) &&
                catalogRegex.map(regex -> regex.matcher(catalog).matches()).orElse(true)) {
            return Optional.of(allow);
        }
        return Optional.empty();
    }
3.
Match rating: 68.68% · See similar code snippets
java logo
public Optional<Set<TablePrivilege>> match(String user, SchemaTableName table)
    {
        if (userRegex.map(regex -> regex.matcher(user).matches()).orElse(true) &&
                schemaRegex.map(regex -> regex.matcher(table.getSchemaName()).matches()).orElse(true) &&
                tableRegex.map(regex -> regex.matcher(table.getTableName()).matches()).orElse(true)) {
            return Optional.of(privileges);
        }
        return Optional.empty();
    }
4.
toberkoe/fluent-assertions · StringAssert.java
Match rating: 66.66% · See similar code snippets
java logo
public StringAssert matches(String regex) {
        if (test(s -> s.matches(regex))) {
            return this;
        }

        throw error("Expected %s to match regex %s", value, regex);
    }
5.
alkacon/opencms-core · CmsRegexValidator.java
Match rating: 66.55% · See similar code snippets
java logo
private static boolean matchRuleRegex(String regex, String value) {

        if (value == null) {
            value = "";
        }

        if (regex == null) {
            return true;
        }
        if ((regex.length() > 0) && (regex.charAt(0) == '!')) {
            return !value.matches(regex.substring(1));
        } else {
            return value.matches(regex);
        }
    }
6.
yoojia/NextInputs-Android · Texts.java
Match rating: 65.53% · See similar code snippets
java logo
public static boolean regexMatch(String input, String regex) {
        return Pattern.compile(regex).matcher(input).matches();
    }
7.
Match rating: 63.35% · See similar code snippets
java logo
@Override
    public boolean matches(String name, String regex) {
        if (!regex.startsWith("/")) {
            regex = "/" + regex;
        }
        return name.matches(regex);
    }
8.
bingoohuang/westcache · Keys.java
Match rating: 63.03% · See similar code snippets
java logo
public static boolean matchRegex(String str, String regex) {
        try {
            return str.matches(regex);
        } catch (PatternSyntaxException e) {
            log.error("regex syntax error : {}", regex);
            return false;
        }
    }
9.
apache/flink · SqlFunctionUtils.java
Match rating: 62.46% · See similar code snippets
java logo
public static Boolean regExp(String s, String regex){
		if (regex.length() == 0) {
			return false;
		}
		try {
			return (REGEXP_PATTERN_CACHE.get(regex)).matcher(s).find(0);
		} catch (Exception e) {
			LOG.error("Exception when compile and match regex:" +
				regex + " on: " + s, e);
			return false;
		}
	}
10.
graknlabs/grakn · AttributeTypeImpl.java
Match rating: 62.19% · See similar code snippets
java logo
private void checkInstancesMatchRegex(@Nullable String regex) {
        if (regex != null) {
            Pattern pattern = Pattern.compile(regex);
            instances().forEach(resource -> {
                String value = (String) resource.value();
                Matcher matcher = pattern.matcher(value);
                if (!matcher.matches()) {
                    throw TransactionException.regexFailure(this, value, regex);
                }
            });
        }
    }