@@ -77,12 +77,15 @@ class Builder extends BaseBuilder
77
77
'like ' ,
78
78
'not like ' ,
79
79
'between ' ,
80
+ 'ilike ' ,
80
81
'& ' ,
81
82
'| ' ,
82
83
'^ ' ,
83
84
'<< ' ,
84
85
'>> ' ,
85
86
'rlike ' ,
87
+ 'regexp ' ,
88
+ 'not regexp ' ,
86
89
'exists ' ,
87
90
'type ' ,
88
91
'mod ' ,
@@ -113,7 +116,6 @@ class Builder extends BaseBuilder
113
116
* @var array
114
117
*/
115
118
protected $ conversion = [
116
- '= ' => '= ' ,
117
119
'!= ' => 'ne ' ,
118
120
'<> ' => 'ne ' ,
119
121
'< ' => 'lt ' ,
@@ -123,7 +125,6 @@ class Builder extends BaseBuilder
123
125
'regexp ' => 'regex ' ,
124
126
'not regexp ' => 'not regex ' ,
125
127
'ilike ' => 'like ' ,
126
- 'not ilike ' => 'not like ' ,
127
128
'elemmatch ' => 'elemMatch ' ,
128
129
'geointersects ' => 'geoIntersects ' ,
129
130
'geowithin ' => 'geoWithin ' ,
@@ -1068,6 +1069,7 @@ protected function compileWhereBasic(array $where): array
1068
1069
throw new \LogicException (sprintf ('Missing expected starting delimiter in regular expression "%s", supported delimiters are: %s ' , $ value , implode (' ' , self ::REGEX_DELIMITERS )));
1069
1070
}
1070
1071
$ e = explode ($ delimiter , $ value );
1072
+ // We don't try to detect if the last delimiter is escaped. This would be an invalid regex.
1071
1073
if (count ($ e ) < 3 ) {
1072
1074
throw new \LogicException (sprintf ('Missing expected ending delimiter "%s" in regular expression "%s" ' , $ delimiter , $ value ));
1073
1075
}
@@ -1078,7 +1080,7 @@ protected function compileWhereBasic(array $where): array
1078
1080
$ value = new Regex ($ regstr , $ flags );
1079
1081
}
1080
1082
1081
- // For inverse regex operations, we can just use the $not operatorwith the Regex
1083
+ // For inverse regex operations, we can just use the $not operator with the Regex
1082
1084
$ operator = $ operator === 'regex ' ? '= ' : 'not ' ;
1083
1085
}
1084
1086
@@ -1260,21 +1262,6 @@ protected function compileWhereRaw(array $where): mixed
1260
1262
return $ where ['sql ' ];
1261
1263
}
1262
1264
1263
- protected function invalidOperator ($ operator )
1264
- {
1265
- if (! is_string ($ operator )) {
1266
- return true ;
1267
- }
1268
-
1269
- $ operator = strtolower ($ operator );
1270
-
1271
- if (isset ($ this ->conversion [$ operator ])) {
1272
- return false ;
1273
- }
1274
-
1275
- return parent ::invalidOperator ($ operator );
1276
- }
1277
-
1278
1265
/**
1279
1266
* Set custom options for the query.
1280
1267
*
0 commit comments