We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28fd6ce commit afdd8c3Copy full SHA for afdd8c3
src/Jenssegers/Mongodb/Query/Builder.php
@@ -905,7 +905,9 @@ protected function compileWhereBasic($where)
905
// Replace like with a Regex instance.
906
if ($operator == 'like') {
907
$operator = '=';
908
- $regex = str_replace('%', '', $value);
+
909
+ // Convert to regular expression.
910
+ $regex = preg_replace('#(^|[^\\\])%#', '$1.*', preg_quote($value));
911
912
// Convert like to regular expression.
913
if (! starts_with($value, '%')) {
0 commit comments