code: public static String createRegex(String value, boolean ignoreCase)
      {
          if (value == null)
          {
              throw new IllegalArgumentException("String cannot be null");
          }
  
          int len = value.length();
          if (len == 0)
          {
              return "";
          }
  
          StringBuilder sb = new StringBuilder(len * 2);
  
          if (ignoreCase)
          {
              sb.append("(?i)");
          }
  
          sb.append("^");
  
          for (int i = 0; i < len; i++)
          {
              char c = value.charAt(i);
              if ("[](){}.*+?$^|#\\".indexOf(c) != -1)
              {
                  sb.append("\\");
              }
              sb.append(c);
          }
          sb.append("$");
          return sb.toString();
      }
docs: Generates the regular expression for matching string for like operator.
  
  @param value
  the value
  @param ignoreCase
  whether to ignore the case
  @return the string