Skip to content
A Java library with wildcard utils
Branch: master
Clone or download
Latest commit 433d20f Jun 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue templates May 27, 2018
docs
gradle/wrapper documentation updated Apr 1, 2019
jwildcard documentation minor fix Apr 1, 2019
.gitignore #i13 - rules support regex in wildcards now Jun 23, 2018
.travis.yml travis script fix Jun 23, 2018
LICENSE Initial commit Mar 26, 2018
README.md Update README.md Apr 2, 2019
RELEASE_NOTES.md updated RELEASE NOTES Apr 1, 2019
build.gradle #i13 - rules support regex in wildcards now Jun 23, 2018
gradle.properties Update gradle.properties Apr 1, 2019
gradlew #i13 - rules support regex in wildcards now Jun 23, 2018
gradlew.bat #i13 - rules support regex in wildcards now Jun 23, 2018
settings.gradle #i13 - rules support regex in wildcards now Jun 23, 2018

README.md

JWildcard

A collection of wildcard utilities. This library helps to convert wildcards to regex string. Wildcards can be declared using custom made rules.

Getting Started

Build Status Download
Sonar quality gates Sonar Lines of code Sonar Coverage

Gradle build.gradle

repositories {
    jcenter()
}

dependencies {
    compile 'com.yevdo:jwildcard:1.4'
}

Maven pom.xml

<dependency>
  <groupId>com.yevdo</groupId>
  <artifactId>jwildcard</artifactId>
  <version>1.4</version>
  <type>pom</type>
</dependency>

API

API documentation https://alenon.github.io/JWildcard/

Examples:

This wildcard:

"mywil?card*"

will be converted to this regex string:

"\Qmywil\E.\Qcard\E.*"

If you wish to convert wildcard to regex string use:

JWildcard.wildcardToRegex("mywil?card*");

Default wildcard rules are: "?" -> ".", "*" -> ".*", but you can change the default behaviour if you wish to, by simply defining the new rules.

JWildcard.wildcardToRegex(wildcard, rules, strict);

If you wish to check matching directly you can use this:

JWildcard.matches("mywild*", "mywildcard");

If wish to convert wildcard string to SQL like pattern:

JWildcard.wildcardToSqlPattern("?wild*Ca?rd*") // outputs this => _wild%Ca_rd%
You can’t perform that action at this time.