Skip to content

Commit bbc0309

Browse files
authored
fix regex
fix regex to avoid matching {{Copy to Wikimedia Commons in}}
1 parent afbf1d8 commit bbc0309

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/twinkletag.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ Twinkle.tag.callbacks = {
18991899
$.each(params.tags, (k, tag) => {
19001900
// when other commons-related tags are placed, remove "move to Commons" tag
19011901
if (['Keep local', 'Do not move to Commons'].includes(tag)) {
1902-
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, '');
1902+
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)(?!( in))\}\}/gi, '');
19031903
}
19041904

19051905
currentTag = tag;

0 commit comments

Comments
 (0)