« get me outta code hell

data: detect & report miscapitalization in commentary heading - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/wiki-data.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-02-14 12:03:52 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-02-14 13:35:33 -0400
commitd642e41ed5459b86a55b0db274a93adb2f7d907a (patch)
tree8652a41fc631ad765cb07ae40fd1a1c08a2f6ace /src/util/wiki-data.js
parent9b13c1eb3766aeec4be518a755b209d6e0cdfd42 (diff)
data: detect & report miscapitalization in commentary heading
Diffstat (limited to 'src/util/wiki-data.js')
-rw-r--r--src/util/wiki-data.js8
1 files changed, 6 insertions, 2 deletions
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>(?<artistReferences>.+?)(?:\|(?<artistDisplayText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?<date>[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>(?<artistReferences>.+?)(?:\|(?<artistDisplayText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?<date>[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