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 text
    static java.lang.String wildcardToRegex​(java.lang.String wildcard)
    Converts wildcard to regex using default set of rules and strict flag set to true
    static java.lang.String wildcardToRegex​(java.lang.String wildcard, boolean strict)
    Converts wildcard to regex using default set of rules
    static java.lang.String wildcardToRegex​(java.lang.String wildcard, JWildcardRules rules, boolean strict)
    Converts wildcard to regex using rules
    static java.lang.String wildcardToSqlPattern​(java.lang.String wildcard)
    Converts wildcard to sql pattern using default set of rules

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 wildcard
      strict - 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 wildcard
      rules - a collection of desired wildcard rules to use in conversion process
      strict - 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 wildcard
      text - 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)