code: @Override
  	public String sqlRegex(String columnname, String pattern, boolean caseinSensitive, boolean multiLine, boolean dotAllMode) {
          Pattern quotes = Pattern.compile("[\"`\\['].*[\"`\\]']");
  		if(quotes.matcher(pattern).matches() ) {
  		pattern = pattern.substring(1, pattern.length() - 1); // remove the
  		// enclosing
  		// quotes
          }
  		String sql = columnname + " REGEXP ";
  		if (!caseinSensitive) 
  			sql += "BINARY ";
  			
  		return sql + "'" + pattern + "'";
  	}
docs: Based on information in MySQL 5. 1 manual at
  http://dev.mysql.com/doc/refman/5.1/en/regexp.html
  and
  http://dev.mysql.com/doc/refman/5.1/en/pattern-matching.html