original_string: public function sql_regex($positivematch = true, $casesensitive = false) {
          $collation = '';
          if ($casesensitive) {
              if (substr($this->get_dbcollation(), -4) !== '_bin') {
                  $collationinfo = explode('_', $this->get_dbcollation());
                  $collation = 'COLLATE ' . $collationinfo[0] . '_bin ';
              }
          } else {
              if ($this->get_dbcollation() == 'utf8_bin') {
                  $collation = 'COLLATE utf8_unicode_ci ';
              } else if ($this->get_dbcollation() == 'utf8mb4_bin') {
                  $collation = 'COLLATE utf8mb4_unicode_ci ';
              }
          }
  
          return $collation . ($positivematch ? 'REGEXP' : 'NOT REGEXP');
      }
code: public function sql_regex($positivematch = true, $casesensitive = false) {
          $collation = '';
          if ($casesensitive) {
              if (substr($this->get_dbcollation(), -4) !== '_bin') {
                  $collationinfo = explode('_', $this->get_dbcollation());
                  $collation = 'COLLATE ' . $collationinfo[0] . '_bin ';
              }
          } else {
              if ($this->get_dbcollation() == 'utf8_bin') {
                  $collation = 'COLLATE utf8_unicode_ci ';
              } else if ($this->get_dbcollation() == 'utf8mb4_bin') {
                  $collation = 'COLLATE utf8mb4_unicode_ci ';
              }
          }
  
          return $collation . ($positivematch ? 'REGEXP' : 'NOT REGEXP');
      }
code_tokens: public function sql_regex ( $ positivematch = true , $ casesensitive = false ) { $ collation = '' ; if ( $ casesensitive ) { if ( substr ( $ this -> get_dbcollation ( ) , - 4 ) !== '_bin' ) { $ collationinfo = explode ( '_' , $ this -> get_dbcollation ( ) ) ; $ collation = 'COLLATE ' . $ collationinfo [ 0 ] . '_bin ' ; } } else { if ( $ this -> get_dbcollation ( ) == 'utf8_bin' ) { $ collation = 'COLLATE utf8_unicode_ci ' ; } else if ( $ this -> get_dbcollation ( ) == 'utf8mb4_bin' ) { $ collation = 'COLLATE utf8mb4_unicode_ci ' ; } } return $ collation . ( $ positivematch ? 'REGEXP' : 'NOT REGEXP' ) ; }
docstring: Return regex positive or negative match sql
  @param bool $positivematch
  @param bool $casesensitive
  @return string or empty if not supported
docstring_tokens: Return regex positive or negative match sql