break;
case 'mhas':
- // mhas == multiple has
- if ($value !== NULL && count($value) > 0) {
- $sqlOP = $this->getSQLOperator($op);
- $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
- }
- break;
-
case 'mnot':
- // mnot == multiple is not one of
+ // mhas == multiple has
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause = "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
+ $operator = '';
+ if ($op == 'mnot') {
+ // mnot == multiple is not one of
+ $operator = 'NOT';
+ }
+ $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', (array) $value) . "[[:cntrl:]]*";
+ $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'";
}
break;
if ($op == 'notin') {
$operator = 'NOT';
}
- $clause = "( {$field['dbAlias']} {$operator} REGEXP '[[:<:]]" .
- implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
+
+ $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', $value) . "[[:cntrl:]]*";
+ $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'";
}
$op = NULL;
}
if ($op == 'notin') {
$operator = 'NOT';
}
- $clause = "( {$field['dbAlias']} {$operator} REGEXP '[[:<:]]" .
- implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
+
+ $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', $value) . "[[:cntrl:]]*";
+ $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'";
}
$op = NULL;
}