aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stringobject.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-11-12 15:25:18 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-11-14 10:48:06 +0100
commit9d9413f3d3983b1d24fd878da14eed153e83cbaa (patch)
treecd0c28b08f33e918bebfa0a7f547096ffa2e67e5 /src/qml/jsruntime/qv4stringobject.cpp
parentd148d8d78419effdc28b6bf74704379aa9a5950a (diff)
QtQml: Fix regular expressions with multiple matches
We have to match the next capture one character past the last one, not at the same place. Otherwise we match the same thing again. Pick-to: 6.8 6.5 Fixes: QTBUG-130974 Change-Id: Ifc1cf7c95c7777ba7140f141b26455e155db73db Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 40d176723b..31219228f0 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -778,7 +778,7 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val
nMatchOffsets += re->captureCount() * 2;
if (!regExp->global())
break;
- offset = qMax(offset + 1, matchOffsets[oldSize + 1]);
+ offset = qMax(offset, matchOffsets[oldSize + 1]) + 1;
}
if (regExp->global()) {
regExp->setLastIndex(0);