fix: regex issue

This commit is contained in:
Aien Saidi 2021-03-30 19:10:23 +02:00 committed by Sascha
parent d2845605c2
commit 41ee97a4f6

View File

@ -35,7 +35,7 @@ function parse(query: string): Query {
const params: Query = {};
// TODO: support escaping without quotes
const re = /(\w+):([A-Za-z0-9-]+|"([^"]*)")/g;
const re = /(\w+):([A-Za-z0-9-]+|(["'])(([^\3]|\\.)*)\3)+/g;
let matches;
while ((matches = re.exec(query)) !== null) {
if (!params[matches[1]]) {
@ -43,8 +43,8 @@ function parse(query: string): Query {
}
let value;
if (matches[3]) {
value = matches[3];
if (matches[4]) {
value = matches[4];
} else {
value = matches[2];
}