diff --git a/core/modules/parsers/wikiparser/rules/commentblock.js b/core/modules/parsers/wikiparser/rules/commentblock.js index 84ee897ba..b7651c272 100644 --- a/core/modules/parsers/wikiparser/rules/commentblock.js +++ b/core/modules/parsers/wikiparser/rules/commentblock.js @@ -31,7 +31,7 @@ exports.findNextMatch = function(startPos) { this.matchRegExp.lastIndex = startPos; this.match = this.matchRegExp.exec(this.parser.source); if(this.match) { - this.endMatchRegExp.lastIndex = startPos + this.match[0].length; + this.endMatchRegExp.lastIndex = this.match.index + this.match[0].length; this.endMatch = this.endMatchRegExp.exec(this.parser.source); if(this.endMatch) { return this.match.index; diff --git a/core/modules/parsers/wikiparser/rules/commentinline.js b/core/modules/parsers/wikiparser/rules/commentinline.js index 6e697e6c0..671bd79d6 100644 --- a/core/modules/parsers/wikiparser/rules/commentinline.js +++ b/core/modules/parsers/wikiparser/rules/commentinline.js @@ -31,7 +31,7 @@ exports.findNextMatch = function(startPos) { this.matchRegExp.lastIndex = startPos; this.match = this.matchRegExp.exec(this.parser.source); if(this.match) { - this.endMatchRegExp.lastIndex = startPos + this.match[0].length; + this.endMatchRegExp.lastIndex = this.match.index + this.match[0].length; this.endMatch = this.endMatchRegExp.exec(this.parser.source); if(this.endMatch) { return this.match.index;