diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index 6804473afbfee6ed48699199fd1ca0a835291606..5c2b102779a399e3c113bce3bd0686043d7462f6 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -206,7 +206,7 @@ var canvas_events = (function() {
         text_to_fudi = function(text, obj_class, escapes) {
             if (obj_class !== "comment") {
                 // trim whitespace at the beginning and end (unless escaped)
-                text = text.replace(/^\s+|(?<!(\\\\)*\\)\s+$/g, "");
+                text = text.replace(/^\s+|(?<!\\)\s+$/g, "");
             }
 
             // special case for draw path d="arbitrary path string" ...
@@ -260,7 +260,7 @@ var canvas_events = (function() {
                 // ag: make sure to exclude \v below since we need these as
                 // newline substitutes which survive binbuf treatment
                 // split on newlines or (unescaped) spaces
-                in_array = msg.split(/(?<!(\\\\)*\\) |[\t\n]/);
+                in_array = msg.split(/(?<!\\) |[\t\n]/);
                 while (in_array.length) {
                     left = in_array.slice(); // make a copy of in_array
                     if (left.toString().length > chunk_max) {
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index a3a97f4e5f7292021f4dbf301056c348e7b410f9..d3f73b58d73bf7eb6f96c8f541923955766f219b 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -1706,7 +1706,7 @@ function enquote (x) {
     .replace(/"/g, "\\\"")
     .replace(/ /g, "\\ ")
     // trim whitespace (unless escaped)
-    .replace(/^\s+|(?<!(\\\\)*\\)\s+$/g, "");
+    .replace(/^\s+|(?<!\\)\s+$/g, "");
 }
 
 // from stackoverflow.com/questions/21698906/how-to-check-if-a-path-is-absolute-or-relative
@@ -7819,7 +7819,7 @@ function gui_textarea(cid, tag, type, x, y, width_spec, height_spec, text,
         // remove leading/trailing whitespace
         if (type !== "comment") {
             // trim whitespace at the beginning and end (unless escaped)
-            text = text.replace(/^\s+|(?<!(\\\\)*\\)\s+$/g, "");
+            text = text.replace(/^\s+|(?<!\\)\s+$/g, "");
         }
         p.textContent = text;
         // append to doc body