@brody.tears
This might help.
It's the code I gave to Steve Doman and Joe Burke for their initial version of StripMtext back in 2003. They later switched to the use of RegularExpressions, which is beyond me.
Focus on the next to last condition where you see "\\ACFHQSTW."
Maybe all you need for the width is "\\W."
I know I made a newer version of the function to accept the formatting codes to remove as an argument, but since I found this much I decided to search no further. But you can let me know if you might want me to find it.
(defun @UnFormat (Mtext KeepLF / Old New Tmp Str)
(cond
((= (type Mtext) 'VLA-Object))
((= (type Mtext) 'Ename)
(setq Mtext (vlax-ename->vla-object Mtext))
)
(1 (setq Mtext nil))
)
(if (= KeepLF 0)(setq KeepLF nil))
(and
Mtext
(= (vlax-get Mtext 'ObjectName) "AcDbMText")
(setq Old (vlax-get Mtext 'TextString))
(setq Tmp Old)
(setq New "")
(while (/= Tmp "")
(cond
((wcmatch (strcase (setq Str (substr Tmp 1 2))) "\\[\\{}`~]")
(setq Tmp (substr Tmp 3)
New (strcat New Str)
)
)
((wcmatch (substr Tmp 1 1) "[{}]")
(setq Tmp (substr Tmp 2))
)
((and KeepLF (wcmatch (strcase (substr Tmp 1 2)) "\\P"))
(setq New (strcat New (substr Tmp 1 2))
Tmp (substr Tmp 3)
)
)
;; added "\n" (03-03-08)
((and KeepLF (wcmatch (strcase (substr Tmp 1 1)) "\N"))
(setq New (strcat New (substr Tmp 1 1))
Tmp (substr Tmp 2)
)
)
((wcmatch (strcase (substr Tmp 1 2)) "\\[LOP]")
(setq Tmp (substr Tmp 3))
)
((wcmatch (strcase (substr Tmp 1 2)) "\\[ACFHQSTW]")
(setq Tmp (substr Tmp (+ 2 (vl-string-search ";" Tmp))))
)
(1
(setq New (strcat New (substr Tmp 1 1))
Tmp (substr Tmp 2)
)
)
)
)
(/= Old New)
(not
(vl-catch-all-error-p
(vl-catch-all-apply
'vlax-put (list Mtext 'TextString New)
)
)
)
)
)