From d642e41ed5459b86a55b0db274a93adb2f7d907a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 14 Feb 2024 12:03:52 -0400 Subject: data: detect & report miscapitalization in commentary heading --- src/util/wiki-data.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/util/wiki-data.js') diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 1c1db6c..cc3bbba 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -665,8 +665,12 @@ export function sortFlashesChronologically(data, { // This regular expression *doesn't* match bodies, which will need to be parsed // out of the original string based on the indices matched using this. // -export const commentaryRegex = - /^(?.+?)(?:\|(?.+))?:<\/i>(?: \((?(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?[a-zA-Z]+ [0-9]{1,2}, [0-9]{4,4}|[0-9]{1,2} [^,]*[0-9]{4,4}|[0-9]{1,4}[-/][0-9]{1,4}[-/][0-9]{1,4}))?\))?/gm; +const commentaryRegexRaw = + String.raw`^(?.+?)(?:\|(?.+))?:<\/i>(?: \((?(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?[a-zA-Z]+ [0-9]{1,2}, [0-9]{4,4}|[0-9]{1,2} [^,]*[0-9]{4,4}|[0-9]{1,4}[-/][0-9]{1,4}[-/][0-9]{1,4}))?\))?`; +export const commentaryRegexCaseInsensitive = + new RegExp(commentaryRegexRaw, 'gmi'); +export const commentaryRegexCaseSensitive = + new RegExp(commentaryRegexRaw, 'gm'); export function filterAlbumsByCommentary(albums) { return albums -- cgit 1.3.0-6-gf8a5