From 707004a85beb8d7c3ca38cb012532120493b5a46 Mon Sep 17 00:00:00 2001 From: Marti Martz Date: Tue, 3 May 2016 08:50:11 -0600 Subject: [PATCH] GM: Detect properly the UserScript metadata block on parse (#1964) Eliminates some false positives --- src/plugins/GreaseMonkey/gm_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/GreaseMonkey/gm_script.cpp b/src/plugins/GreaseMonkey/gm_script.cpp index b8c6ac2b5..4a44d402c 100644 --- a/src/plugins/GreaseMonkey/gm_script.cpp +++ b/src/plugins/GreaseMonkey/gm_script.cpp @@ -238,7 +238,7 @@ void GM_Script::parseScript() const QString fileData = QString::fromUtf8(file.readAll()); - QzRegExp rx(QSL("// ==UserScript==(.*)// ==/UserScript==")); + QzRegExp rx(QSL("(?:^|\\n)// ==UserScript==(.*)\\n// ==/UserScript==(?:\\n|$)")); rx.indexIn(fileData); QString metadataBlock = rx.cap(1).trimmed();