From 78c1a74660a2e25b3960beb42e3a6f8419c8b3c3 Mon Sep 17 00:00:00 2001 From: zixaphir Date: Thu, 31 Aug 2023 14:18:35 -0700 Subject: [PATCH] Account for edge case where user deleted leading separator. --- javascript/extraNetworks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/extraNetworks.js b/javascript/extraNetworks.js index eb2b9ebd7..ca87beade 100644 --- a/javascript/extraNetworks.js +++ b/javascript/extraNetworks.js @@ -154,7 +154,7 @@ function tryToRemoveExtraNetworkFromPrompt(textarea, text) { var extraTextAfterNet = m[2]; var partToSearch = m[1]; var foundAtPosition = -1; - var escapedSeparator = reEscape(opts.extra_networks_add_text_separator); + var escapedSeparator = `(?:${reEscape(opts.extra_networks_add_text_separator)})?`; var re = new RegExp(escapedSeparator + re_extranet_str, 'g'); newTextareaText = textarea.value.replaceAll(re, function(found, net, pos) { m = found.match(re_extranet);