Merge "Remove matching groups from regex"

This commit is contained in:
jenkins-bot 2016-02-24 16:01:34 +00:00 committed by Gerrit Code Review
commit 109ee53725

View file

@ -150,14 +150,14 @@
var finalOutput,
fullWikitext = $textbox.val(),
endNoIncludeLength = '</noinclude>'.length,
parts = fullWikitext.match(
/<templatedata>([\s\S]*?)<\/templatedata>/i
);
// NB: This pattern contains no matching groups: (). This avoids
// corruption if the template data JSON contains $1 etc.
templatedataPattern = /<templatedata>[\s\S]*?<\/templatedata>/i;
if ( parts && parts[ 1 ] ) {
if ( fullWikitext.match( templatedataPattern ) ) {
// <templatedata> exists. Replace it
finalOutput = fullWikitext.replace(
/(<templatedata>)([\s\S]*?)(<\/templatedata>)/i,
templatedataPattern,
'<templatedata>\n' + JSON.stringify( newTemplateData, null, '\t' ) + '\n</templatedata>'
);
} else {