Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
fix regex generation (#2377)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyjok committed Apr 7, 2023
1 parent 24a45bc commit 2bdc30c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sql3/planner/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -2990,11 +2990,12 @@ func (p *ExecutionPlanner) compileOrderingTermExpr(expr parser.Expr, projections
// used by the LIKE/NOT LIKE operator
func wildCardToRegexp(pattern string) string {
var result strings.Builder
result.WriteString("(?i)")

result.WriteString("(?i)^")
rpattern := strings.Replace(pattern, "%", ".*", -1)
rpattern = strings.Replace(rpattern, "_", ".+", -1)
result.WriteString(rpattern)
result.WriteString("$")

return result.String()
}
Expand Down

0 comments on commit 2bdc30c

Please sign in to comment.