Weird behavior of a TextMatch edit check with templates/links
Open, Needs TriagePublicBUG REPORT

Description

In ruwiki, the check "Проверить пунктуацию" for fixing punctuation problems with - and em dash:

	"--": "—",
	"\\s-\\s": " — ",
	"\\s-(\\d+)": " −$1",
	"\\s-([а-яё]+)": " —$1",
	"([^\\d\\s]+)(—|\\s—|—\\s)([^\\d\\s]+)": "$1 — $3"

behaves weirdly when there are templates around an em dash. For example, see a section of article Краснодарский край:

image.png (1,850×479 px, 101 KB)

The edit check suggests something which looks like changing em dash to em dash (which already isn't very useful), but when I click it it just removes the templates... I have no idea why this happens and what I should fix so that it wouldn't.

A similar thing but for links instead of templates happens here.

A similar thing happens here with numbers in templates.

Similar thing here with a template and the space isn't actually added at all.

orig: T407664#11969479

Event Timeline

Wellverywell renamed this task from Weird behavior of a TextMatch edit check on non-brekable spaces to Weird behavior of a TextMatch edit check with templates/links.Jun 6 2026, 9:15 PM
Wellverywell updated the task description. (Show Details)

Change #1319546 had a related patch set uploaded (by Medelius; author: Medelius):

[mediawiki/extensions/VisualEditor@master] TextMatch: support templates in regex replacements

https://gerrit.wikimedia.org/r/1319546

Change #1319752 had a related patch set uploaded (by Medelius; author: Medelius):

[VisualEditor/VisualEditor@master] Update ve.dm.LinearData.getText to take optional replacement param

https://gerrit.wikimedia.org/r/1319752

Change #1319752 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] Update ve.dm.LinearData.getText to take optional replacement param

https://gerrit.wikimedia.org/r/1319752

Change #1319896 had a related patch set uploaded (by Medelius; author: Medelius):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (1b770f4be)

https://gerrit.wikimedia.org/r/1319896

Change #1319896 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (eb7fe3518)

https://gerrit.wikimedia.org/r/1319896

Change #1319546 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] TextMatch: support templates in regex replacements

https://gerrit.wikimedia.org/r/1319546