I have a 'partial' solution. See attached .dwg for details.
Does all correctly except those \\\p in Mtext.
Feel free to grab and modify (uses old lisp, no Vlisp).
;; chgtxt.lsp
;; rev 1.0
;; Search 'old' text, replace with 'new' text in TEXT or MTEXT
;;
;; Local Function to check for Old String / Replace with New String..
;;
(defun s_r ( ostr nstr oldtext )
(if (and (/= ostr nil)(/= nstr nil)(/= oldtext nil)); old string, new string
(progn
(setq os ostr ns nstr n_str "" found 0 si 1)
(setq osl (strlen os))
(setq nsl (strlen ns))
(setq s oldtext); pass in old value
(while (= osl (setq sl (strlen (setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns (substr s (+ si osl))))
(setq found 1); Found old string
(setq si (+ si nsl))
); end progn
(setq si (1+ si))
); end if
); end while
(if (= found 1)(setq n_str s)); modified string
); end progn
); end if
(princ)
); end function
;;
;; Function to change matching text strings in Text or Mtext
;;
(defun C:chgtxt (/ oldstring newstring )
(setq oldstring (getstring 1 "\nOld string to replace = ")); e.g. )\\
(setq newstring (getstring 1 "\nNew string replacement = ")); e.g. ADDED Something
(setq ss nil C 0)
(setq ss (ssget "X" (list (cons 0 "*TEXT"))))
(if ss
(progn
(repeat (sslength ss)
(setq ent (entget (ssname ss C))); entity list
(setq otxt (cdr (assoc 1 ent))); just the old text string
(s_r oldstring newstring otxt)
(if (= found 1)
(entmod (setq ent (subst (cons 1 n_str)(cons 1 otxt) ent)))
); if
(setq C (+ C 1))
); repeat
); progn
); if
); function
ECCAD