code: @Override
  	public String sqlRegex(String columnname, String pattern, boolean caseinSensitive, boolean multiLine, boolean dotAllMode) {
  
          if(quotes.matcher(pattern).matches() ) {
              pattern = pattern.substring(1, pattern.length() - 1); // remove the
              // enclosing
              // quotes
          }
  		//An ARE can begin with embedded options: a sequence (?n)  specifies options affecting the rest of the RE. 
  		//n is newline-sensitive matching
  		String flags = "";
  		if (multiLine)
  			flags = "(?w)"; //inverse partial newline-sensitive matching
  		else
  		if(dotAllMode)
  			flags = "(?p)"; //partial newline-sensitive matching
  		
  		return columnname + " ~" + ((caseinSensitive)? "* " : " ") + "'"+ ((multiLine && dotAllMode)? "(?n)" : flags) + pattern + "'";
  	}
docs: Based on documentation of postgres 9.1 at
  http://www.postgresql.org/docs/9.3/static/functions-matching.html