From e7d1398546104f159578b295d929eff623063e15 Mon Sep 17 00:00:00 2001 From: lana-k Date: Mon, 17 May 2021 21:34:24 +0200 Subject: [PATCH] Rewrite reg exp: make them work in Safari #52 --- src/lib/database/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/database/index.js b/src/lib/database/index.js index a42c085..b6d8570 100644 --- a/src/lib/database/index.js +++ b/src/lib/database/index.js @@ -127,10 +127,10 @@ function getAst (sql) { // It throws an error if tokenizer has an arguments: // https://github.com/codeschool/sqlite-parser/issues/59 const fixedSql = sql - .replace(/(?<=tokenize=.+)"tokenchars=.+"/, '') - .replace(/(?<=tokenize=.+)"remove_diacritics=.+"/, '') - .replace(/(?<=tokenize=.+)"separators=.+"/, '') - .replace(/tokenize=.+(?=(,|\)))/, 'tokenize=unicode61') + .replace(/(tokenize=[^,]+)"tokenchars=.+?"/, '$1') + .replace(/(tokenize=[^,]+)"remove_diacritics=.+?"/, '$1') + .replace(/(tokenize=[^,]+)"separators=.+?"/, '$1') + .replace(/tokenize=.+?(,|\))/, 'tokenize=unicode61$1') return sqliteParser(fixedSql) }