Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/304219
Change subject: QuerySamples parser: replace [^] with more robust [\s\S] ...................................................................... QuerySamples parser: replace [^] with more robust [\s\S] Per argument given in http://stackoverflow.com/a/16119722 Quote: "I recommend against using [^] anyway. On one hand, JavaScript is the only flavor I know that supports that idiom, and even there it's used nowhere near as often as [\s\S]. On the other hand, most other flavors let you escape the ] by listing it first. In other words, in JavaScript [^][^] matches any two characters, but in .NET it matches any one character other than ], [, or ^." The {{Q|…|…}} template is special because it is not expected to contain these characters, so we can safely build a meaningfull negative character class that does not trigger backracking. Change-Id: I27ce465e5389a8b70991ac3ac80a129099cbce5a --- M wikibase/queryService/api/QuerySamples.js 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/19/304219/1 diff --git a/wikibase/queryService/api/QuerySamples.js b/wikibase/queryService/api/QuerySamples.js index 37da33b..8c56f54 100644 --- a/wikibase/queryService/api/QuerySamples.js +++ b/wikibase/queryService/api/QuerySamples.js @@ -78,9 +78,9 @@ */ SELF.prototype._extractExamples = function ( section, sectionHeader ) { var regexParagraph = /(?:=+)([^=]*)(?:=+)\n(?:[]*?)(?:[^=]*?)(\{\{SPARQL\s*\|[\s\S]*?}}\n)/g, - regexQuery = /query\s*=([^]+)(?:}}|\|)/, - regexExtraPrefix = /extraprefix\s*=([^]+?)(?:\||}})/, - regexTags = /\{\{Q\|([^]+?)\|([^]+?)}}/g, + regexQuery = /query\s*=([\s\S]+)(?:}}|\|)/, + regexExtraPrefix = /extraprefix\s*=([\s\S]+?)(?:\||}})/, + regexTags = /\{\{Q\|([^{|}]+)\|([^{|}]+)}}/g, m, examples = []; -- To view, visit https://gerrit.wikimedia.org/r/304219 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I27ce465e5389a8b70991ac3ac80a129099cbce5a Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
