Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.2.0
-
None
-
Windows 7, Qt 5.2.0, VS2010
-
19025ab3422658ab27415cee99336d88a4ae19fa (qtdeclarative)
Description
RegExp.$1 is not returning the collect value with Qt 5.2. When the RegExp is used with QML and JavaScript it returns ‘undefined’. This was working correctly with Qt 4.8.
The code below can be used to reproduce the issue. It should have "Text1.TextNew" as the text, instead it's "undefined.TextNew".
import QtQuick 2.0 Item { width: 360 height: 360 Component.onCompleted: { console.debug(text.text); } Text { id: text text: regExpTest("Text1.TextOld", ".TextNew"); anchors.centerIn: parent } function regExpTest(orgText, replaceText) { var result = ""; var test =/(Text1)\..*$/; var matchResult = orgText.match(test) if (matchResult !== null) { result = RegExp.$1 + replaceText; } return result; } }