From c895c374479967795016c07febce9d516fe4c265 Mon Sep 17 00:00:00 2001 From: Kasper Garnaes Date: Wed, 28 Apr 2021 00:24:59 +0200 Subject: [PATCH] Don't use advanced regex not supported by Safari The zero-width negative lookbehind assertion isn't supported by Safari (and likely IE/Edge). The previous fix for this did not actually remove the zero-width negative lookbehind. Consequently we do it now. Originally the purpose of it was to avoid splitting a string on escaped characters. However this is already handled by replacing escaped characters by newlines, splitting along unescaped characters and finally replacing newlines with unescaped characters. Consequently we can just drop the advanced regex entirely. Ref #4922 --- src/apps/related-materials/related-materials.entry.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/related-materials/related-materials.entry.jsx b/src/apps/related-materials/related-materials.entry.jsx index e87f476f..a5ea87c3 100644 --- a/src/apps/related-materials/related-materials.entry.jsx +++ b/src/apps/related-materials/related-materials.entry.jsx @@ -196,7 +196,7 @@ function useGetRelatedMaterials({ function stringToArray(string) { // Replace escaped commas with newlines (which doesn't make sense in a comma // separated string) so we wont split on them. - const unescapedParts = replace(string, "\\,", "\n").split(/(? replace(part, "\n", ",")); // Remove leading and trailing spaces and empty values. const trimmedParts = escapedParts.map(part => part.trim());