A collection of wildcard utilities. This library helps to convert wildcards into regex string. Wildcards can be declared using custom made rules.
This wildcard:
"mywil?card*"
will be converted to this regex string:
"\Qmywil\E.\Qcard\E.*"
In order to convert wildcard into regex string use the following example:
JWildcard.wildcardToRegex("mywil?card*");
Default wildcard rules are: "?" -> ".", "*" -> ".*", but you can change the default behaviour, by simply defining the new rules:
JWildcard.wildcardToRegex(wildcard, rules, strict);
In order to check matching directly you can use the following example:
JWildcard.matches("mywild*", "mywildcard");
In order to convert wildcard string into SQL like pattern:
JWildcard.wildcardToSqlPattern("?wild*Ca?rd*") // outputs this => _wild%Ca_rd%
Library packages stored in both: Github and Artifactory (https://alenon.jfrog.io/) repositories
build.gradle
repositories {
jcenter()
}
dependencies {
compile 'com.yevdo:jwildcard:1.4'
}
pom.xml
<distributionManagement>
<repository>
<id>central</id>
<name>a0yytejrantuj-artifactory-primary-0-releases</name>
<url>https://alenon.jfrog.io/artifactory/maven-releases</url>
</repository>
</distributionManagement>
<dependency>
<groupId>com.yevdo</groupId>
<artifactId>jwildcard</artifactId>
<version>1.5</version>
</dependency>
API documentation https://alenon.github.io/JWildcard/