Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Feb 3, 2016
1 parent a2f4eca commit 4cdb4fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Jenssegers/Mongodb/Query/Builder.php
Expand Up @@ -930,7 +930,9 @@ protected function compileWhereBasic($where)
if ($operator == 'like')
{
$operator = '=';
$regex = str_replace('%', '', $value);

// Convert to regular expression.
$regex = preg_replace('#(^|[^\\\])%#', '$1.*', preg_quote($value));

// Convert like to regular expression.
if ( ! starts_with($value, '%')) $regex = '^' . $regex;
Expand Down

0 comments on commit 4cdb4fb

Please sign in to comment.