Make that 5 1/2 jugs.
This will (hopefully) find a given string in a selection set of mtext and multileader objects and select them (with blue grips). But I doubt that I will try to do a replacement.
Anyway...
There is no undo or error control (but I'm not changing anything in the drawing).
It will likely stumble if formatting codes have been added within the text to find.
It does ignore "\n" and "\\P."
The 'found' variable (selection set) is left global in case you want to highlight or select them again, as in either:
Command: Select; !found
or
(sssetfirst nil found)
(defun c:FindHard ( / *error* mss find i e obj str)
(defun @Anonymous-subst (new old str)
(while (vl-string-search old str)
(setq str (vl-string-subst new old str))
)
str
)
(and
(setq mss (ssget '((0 . "MTEXT,MULTILEADER"))))
(setq find (getstring 1 "\nEnter string to find (case doesn't matter): "))
(setq find (strcase find))
(setq found (ssadd))
(repeat (setq i (sslength mss))
(setq e (ssname mss (setq i (1- i))))
(setq obj (vlax-ename->vla-object e))
(setq str (vlax-get obj 'TextString))
(foreach char '("\n" "\\P")
(setq str (@string-subst " " char str))
)
(setq str (strcase str))
(if (vl-string-search find str)
(ssadd e found)
1
)
)
)
(if found (sssetfirst nil found))
(princ)
)
(defun c:FH ()(c:FindHard))