Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
6.8
-
None
Description
Consider for example the following code expression:
"12345,897".replace(/\B(?=(\d{3})+(?!\d))/g, ".")
In QML this seems to produce `12..345,897` (with a double dot).
Other engine seems to produce a single dot replacement, and indeed it might generally be expected that this should be the outcome of such a replacement.
A small modification to the above expression:
"12345,897".replace(/\B/g, ".")
Produces `1..2.3.4.5,8..9.7` such that non-word-boundaries in certain positions seems to be doubled, albeit not always.
A further modification:
console.log("1_22-33;44:55,88+99*77".replace(/\B/g, "."))
Produces `1.._.2.2-3..3;4..4:5..5,8..8+9..9*7..7` which seems to imply, as the original pattern did, that replacements on non-word-boundaries are being duplicated for the first non-word-boundary after a word-boundary.
In general, we would expect non-word-boundaries to not produce duplicated replacements. The implementation should be investigated to ensure that replacements on non-word-boundaries are not duplicated anymore.
Attachments
Issue Links
- duplicates
-
QTBUG-130974 A regular expression pattern gives unexpected results in QML and QJSEngine.
-
- Closed
-