Package com.yevdo.jwildcard
Class JWildcard
java.lang.Object
com.yevdo.jwildcard.JWildcard
public class JWildcard
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static boolean
matches(java.lang.String wildcard, java.lang.String text)
Will automatically convert wildcard to regex using the default set of rules, and strict flag set to true, and then run matcher on textstatic java.lang.String
wildcardToRegex(java.lang.String wildcard)
Converts wildcard to regex using default set of rules and strict flag set to truestatic java.lang.String
wildcardToRegex(java.lang.String wildcard, boolean strict)
Converts wildcard to regex using default set of rulesstatic java.lang.String
wildcardToRegex(java.lang.String wildcard, JWildcardRules rules, boolean strict)
Converts wildcard to regex using rulesstatic java.lang.String
wildcardToSqlPattern(java.lang.String wildcard)
Converts wildcard to sql pattern using default set of rules
-
Method Details
-
wildcardToRegex
public static java.lang.String wildcardToRegex(java.lang.String wildcard)Converts wildcard to regex using default set of rules and strict flag set to true- Parameters:
wildcard
- a string representation of wildcard- Returns:
string
representation of regex
-
wildcardToRegex
public static java.lang.String wildcardToRegex(java.lang.String wildcard, boolean strict)Converts wildcard to regex using default set of rules- Parameters:
wildcard
- a string representation of wildcardstrict
- a flag which indicates whether to wrap the result regex with ^ and $- Returns:
string
representation of regex
-
wildcardToRegex
public static java.lang.String wildcardToRegex(java.lang.String wildcard, JWildcardRules rules, boolean strict)Converts wildcard to regex using rules- Parameters:
wildcard
- a string representation of wildcardrules
- a collection of desired wildcard rules to use in conversion processstrict
- a flag which indicates whether to wrap the result regex with ^ and $- Returns:
string
representation of regex- Throws:
java.lang.IllegalArgumentException
- if one of the above is null (wildcard, rules)
-
wildcardToSqlPattern
public static java.lang.String wildcardToSqlPattern(java.lang.String wildcard)Converts wildcard to sql pattern using default set of rules- Parameters:
wildcard
- a string representation of wildcard- Returns:
string
representation of sql pattern- Since:
- 1.4
-
matches
public static boolean matches(java.lang.String wildcard, java.lang.String text)Will automatically convert wildcard to regex using the default set of rules, and strict flag set to true, and then run matcher on text- Parameters:
wildcard
- the wildcardtext
- the string to be matched at provided wildcard- Returns:
true
if the text matches the wildcard- Throws:
java.lang.IllegalArgumentException
- if one of the above is null (wildcard, text)
-