Skip to content

Commit

Permalink
Another RegExp fix (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schotsl authored Sep 16, 2021
1 parent a4439a0 commit 2b2b5de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function replaceParams(sql: string, params: any | any[]): string {
if (!params) return sql;
let paramIndex = 0;
sql = sql.replace(/(".+?")|('.+?')|(\?\?)|(\?)/g, (str) => {
sql = sql.replace(/('[^'\\]*(?:\\.[^'\\]*)*')|("[^"\\]*(?:\\.[^"\\]*)*")|(\?\?)|(\?)/g, (str) => {
if (paramIndex >= params.length) return str;
// ignore
if (/".*"/g.test(str) || /'.*'/g.test(str)) {
Expand Down

0 comments on commit 2b2b5de

Please sign in to comment.