diff --git a/src/backends/lua/luahighlighter.cpp b/src/backends/lua/luahighlighter.cpp --- a/src/backends/lua/luahighlighter.cpp +++ b/src/backends/lua/luahighlighter.cpp @@ -28,8 +28,8 @@ addVariables( luahelper_variables() ); addRule(QRegExp(QLatin1String("[A-Za-z0-9_]+(?=\\()")) , functionFormat()); - addRule(QRegExp(QLatin1String("\".*\"")) , stringFormat()); - addRule(QRegExp(QLatin1String("'.*'")) , stringFormat()); + addRule(QRegExp(QLatin1String("\"[^\"]*\"")) , stringFormat()); + addRule(QRegExp(QLatin1String("'[^\'].*'")) , stringFormat()); addRule(QRegExp(QLatin1String("--[^\n]*")) , commentFormat()); // did not add support for the multiline comment or multiline string } diff --git a/src/backends/octave/octavehighlighter.cpp b/src/backends/octave/octavehighlighter.cpp --- a/src/backends/octave/octavehighlighter.cpp +++ b/src/backends/octave/octavehighlighter.cpp @@ -42,8 +42,8 @@ m_keywords << QLatin1String("end"); addKeywords(m_keywords); - addRule(QRegExp(QLatin1String("\".*\"")), stringFormat()); - addRule(QRegExp(QLatin1String("'.*'")), stringFormat()); + addRule(QRegExp(QLatin1String("\"[^\"]*\"")), stringFormat()); + addRule(QRegExp(QLatin1String("'[^']*'")), stringFormat()); rehighlight(); } diff --git a/src/backends/sage/sagehighlighter.cpp b/src/backends/sage/sagehighlighter.cpp --- a/src/backends/sage/sagehighlighter.cpp +++ b/src/backends/sage/sagehighlighter.cpp @@ -73,8 +73,8 @@ << QLatin1String("Warning") << QLatin1String("WindowsError") << QLatin1String("ZeroDivisionError"); addRules(exceptionPatterns, objectFormat()); - addRule(QRegExp(QLatin1String("\".*\"")), stringFormat()); - addRule(QRegExp(QLatin1String("'.*'")), stringFormat()); + addRule(QRegExp(QLatin1String("\"[^\"]*\"")), stringFormat()); + addRule(QRegExp(QLatin1String("'[^']*'")), stringFormat()); addRule(QRegExp(QLatin1String("#[^\n]*")), commentFormat()); } diff --git a/src/backends/scilab/scilabhighlighter.cpp b/src/backends/scilab/scilabhighlighter.cpp --- a/src/backends/scilab/scilabhighlighter.cpp +++ b/src/backends/scilab/scilabhighlighter.cpp @@ -38,8 +38,8 @@ addFunctions(ScilabKeywords::instance()->functions()); addVariables(ScilabKeywords::instance()->variables()); - addRule(QRegExp(QLatin1String("\".*\"")), stringFormat()); - addRule(QRegExp(QLatin1String("'.*'")), stringFormat()); + addRule(QRegExp(QLatin1String("\"[^\"]*\"")), stringFormat()); + addRule(QRegExp(QLatin1String("'[^']*'")), stringFormat()); addRule(QRegExp(QLatin1String("//[^\n]*")), commentFormat()); commentStartExpression = QRegExp(QLatin1String("/\\*"));