diff --git a/src/plugins/GreaseMonkey/gm_script.cpp b/src/plugins/GreaseMonkey/gm_script.cpp index 4a44d402c..066d1e958 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("(?:^|\\n)// ==UserScript==(.*)\\n// ==/UserScript==(?:\\n|$)")); + QzRegExp rx(QSL("(?:^|[\\r\\n])// ==UserScript==(.*)(?:\\r\\n|[\\r\\n])// ==/UserScript==(?:[\\r\\n]|$)")); rx.indexIn(fileData); QString metadataBlock = rx.cap(1).trimmed(); @@ -248,8 +248,9 @@ void GM_Script::parseScript() } QStringList requireList; + QzRegExp rxNL(QSL("(?:\\r\\n|[\\r\\n])")); - const QStringList lines = metadataBlock.split(QLatin1Char('\n'), QString::SkipEmptyParts); + const QStringList lines = metadataBlock.split(rxNL, QString::SkipEmptyParts); foreach (QString line, lines) { if (!line.startsWith(QLatin1String("// @"))) { continue;