<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: find and replace text and mtext in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796653#M135703</link>
    <description>&lt;P&gt;Hi Kent. Thanks for the quick reply. I'd copy the code but still I cant get the whole set on my list to change to dimension layer. it still the last part that is changing ("10" "273").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 May 2019 20:30:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-16T20:30:22Z</dc:date>
    <item>
      <title>find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961280#M135690</link>
      <description>&lt;P&gt;I have this small lisp routine that replaces old&amp;nbsp;text "&lt;EM&gt;&lt;STRONG&gt;JKT @ MUD&lt;/STRONG&gt;&lt;/EM&gt;" with a new text "&lt;STRONG&gt;&lt;EM&gt;MUDLINE&lt;/EM&gt;&lt;/STRONG&gt;" :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; (setq tss2 (ssget "_X" '((0 . "TEXT,MTEXT"))))&lt;BR /&gt;&amp;nbsp; (repeat (sslength tss2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq tdata (entget (ssname tss2 0)))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (= (strcase "&lt;EM&gt;&lt;STRONG&gt;JKT@MUD&lt;/STRONG&gt;&lt;/EM&gt;") (strcase (cdr (assoc 1 tdata))))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (entmod (subst (cons 1 "&lt;EM&gt;&lt;STRONG&gt;MUDLINE&lt;/STRONG&gt;&lt;/EM&gt;") (assoc 1 tdata) tdata))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); end if&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (ssdel (ssname tss2 0) tss2)&lt;BR /&gt;&amp;nbsp; ); end repeat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This routine was to be a small&amp;nbsp;part of a larger lisp routine that will modify our drawings to a new company-wide standard.&lt;/P&gt;&lt;P&gt;I thought this worked perfect for my needs until I realized that the old text is not always just "&lt;EM&gt;&lt;STRONG&gt;JKT @ MUD &lt;/STRONG&gt;&lt;/EM&gt;".&lt;/P&gt;&lt;P&gt;Often the string is accompanined by a number... for example "&lt;EM&gt;JKT @ MUD &lt;STRONG&gt;(-40')&lt;/STRONG&gt;&lt;/EM&gt; "... thus the old string is not found and no change is made.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can this be modified to find all instances of the old string, that may or may not include the attached number, and replace the old portion of that string with the new text? &amp;nbsp;&lt;U&gt;YET still retain the attached number, &lt;/U&gt;if it exists, so we do not lose it as part of the string ... for example "&lt;STRONG&gt;&lt;EM&gt;MUDLINE (-40')&lt;/EM&gt;&lt;/STRONG&gt; "?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not wish for the&amp;nbsp;routine to halt&amp;nbsp;and ask me to enter or pick text to change and enter or pick text to replace it with as these values will be hard coded.&lt;/P&gt;&lt;P&gt;I wish it to act globally on all text and mtext. It is not necessary to work on dimensions or attributed blocks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know AutoCAD's built in Find and Replace can do this with wildcard characters, but again I need a lisp so it will be automatic as there are many instances in each drawing AND I have several other variable text strings that need this same routine copied/modified inside the larger lisp so that their individual strings&amp;nbsp;will change also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help you can provide.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 22:36:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961280#M135690</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-21T22:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961333#M135691</link>
      <description>&lt;P&gt;Hi navarreb,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;perhaps&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;something like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(if (wcmatch (strcase (cdr (assoc 1 tdata))) "*JKT@MUD*")
     (entmod (subst (cons 1 (vl-string-subst "MUDLINE" "JKT @ MUD" (cdr (assoc 1 tdata)))) (assoc 1 tdata) tdata)
     )
  )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 23:16:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961333#M135691</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-12-21T23:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961350#M135692</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi navarreb,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;perhaps&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;something like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(if (wcmatch (strcase (cdr (assoc 1 tdata))) "*JKT@MUD*")
     (entmod (subst (cons 1 (vl-string-subst "MUDLINE" "JKT @ MUD" (cdr (assoc 1 tdata)))) (assoc 1 tdata) tdata)
     )
  )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I tried that as well... It works, but the condition must be modified to&amp;nbsp;"*JKT `@ MUD*"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I think that it could be without wcmatch at all. Just like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(entmod (subst (cons 1 (vl-string-subst "MUDLINE" "JKT @ MUD" (cdr (assoc 1 tdata)))) (assoc 1 tdata) tdata)&lt;/PRE&gt;
&lt;P&gt;... but maybe that is too much extra work... (changing entity for no reason), so like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    (if (/= (setq told (cdr (assoc 1 tdata)))
	    (setq tnew (vl-string-subst "MUDLINE" "JKT @ MUD" told)))
      (entmod (subst (cons 1 tnew) (assoc 1 tdata) tdata))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 23:49:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961350#M135692</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-12-21T23:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961369#M135693</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi navarreb,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;perhaps&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;something like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(if (wcmatch (strcase (cdr (assoc 1 tdata))) "*JKT@MUD*")
     (entmod (subst (cons 1 (vl-string-subst "MUDLINE" "JKT @ MUD" (cdr (assoc 1 tdata)))) (assoc 1 tdata) tdata)
     )
  )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;I tried that as well... It works, but the condition must be modified to&amp;nbsp;"*JKT `@ MUD*"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I think that it could be without wcmatch at all. Just like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(entmod (subst (cons 1 (vl-string-subst "MUDLINE" "JKT @ MUD" (cdr (assoc 1 tdata)))) (assoc 1 tdata) tdata)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi BeekeeCZ,&lt;/P&gt;
&lt;P&gt;that is correct, I did forgot the &lt;STRONG&gt;"`" &lt;/STRONG&gt;@Anonymous escape the @Anonymous&lt;/P&gt;
&lt;P&gt;And yes, we could just use the entmod and the subst, in all text strings...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Henrique&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 23:51:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5961369#M135693</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-12-21T23:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962500#M135694</link>
      <description>&lt;P&gt;Thank you Henrique and BeeKee,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I much appreciate the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have gotten both to work but with this modification it is only discovering the old string in the letter case in which the code has been typed.&lt;/P&gt;&lt;P&gt;Please tell me where in this modified code do I place the "strcase" option so that no matter whether the old string it spelled in uppercase, lowercase, or a combination of both, it will still be found?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 20:10:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962500#M135694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-22T20:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962601#M135695</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Thank you Henrique and BeeKee,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I much appreciate the help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have gotten both to work but with this modification it is only discovering the old string in the letter case in which the code has been typed.&lt;/P&gt;
&lt;P&gt;Please tell me where in this modified code do I place the "strcase" option so that no matter whether the old string it spelled in uppercase, lowercase, or a combination of both, it will still be found?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here you go....&amp;nbsp;let's make it general... with variables..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Case of both &lt;EM&gt;told&lt;/EM&gt; (as origin) and &lt;EM&gt;lookfor&lt;/EM&gt; (as text to match) are uppercase.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;(defun c:testfunction ()
  (setq lookfor (getstring T "\nLook for: ")
	replacewith (getstring T "\nReplace with: "))
  
  (setq tss2 (ssget "_X" '((0 . "TEXT,MTEXT"))))
  (repeat (sslength tss2)
    (setq tdata (entget (ssname tss2 0)))
    (if (/= (setq told (cdr (assoc 1 tdata)))
	    (setq tnew (vl-string-subst replacewith &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;(strcase&lt;/STRONG&gt;&lt;/FONT&gt; lookfor&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt; (strcase&lt;/FONT&gt;&lt;/STRONG&gt; told&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;)))
      (entmod (subst (cons 1 tnew) (assoc 1 tdata) tdata))
      ); end if
    (ssdel (ssname tss2 0) tss2)
    ); end repeat
  
)&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 21:29:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962601#M135695</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-12-22T21:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962647#M135696</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Thank you Henrique and BeeKee,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I much appreciate the help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have gotten both to work but with this modification it is only discovering the old string in the letter case in which the code has been typed.&lt;/P&gt;
&lt;P&gt;Please tell me where in this modified code do I place the "strcase" option so that no matter whether the old string it spelled in uppercase, lowercase, or a combination of both, it will still be found?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="hps"&gt;Maybe&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;something like this...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)
(defun c:demo (/ i obj RegExp ss)
   (if (setq ss (ssget "_X" '((0 . "MTEXT,TEXT"))))
      (progn
         (setq RegExp (vlax-get-or-create-object "VBScript.RegExp"))
         (vlax-put-property RegExp 'Global actrue)
         (vlax-put-property RegExp 'Ignorecase actrue)
         (vlax-put-property RegExp 'Multiline actrue)
         (vlax-put-property RegExp 'Pattern "JKT @ MUD ")
         (repeat (setq i (sslength ss))
            (setq obj (vlax-ename-&amp;gt;vla-object (ssname ss (setq i (1- i)))))
            (if (vlax-write-enabled-p obj)
               (vla-put-textstring obj (vlax-invoke RegExp 'Replace (vla-get-textstring obj) "MUDLINE"))
            )
         )
         (vlax-release-object RegExp)
      )
   )
   (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 21:51:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962647#M135696</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-12-22T21:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962701#M135697</link>
      <description>&lt;P&gt;Thanks for the excellent help guys.&lt;/P&gt;&lt;P&gt;These both work great!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 22:33:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962701#M135697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-22T22:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962708#M135698</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the excellent help guys.&lt;/P&gt;
&lt;P&gt;These both work great!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome, navarreb!&lt;BR /&gt;Glad I could help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;Nice solution!&lt;BR /&gt;&lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 22:40:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5962708#M135698</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-12-22T22:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5963255#M135699</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the excellent help guys.&lt;/P&gt;
&lt;P&gt;These both work great!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome, navarreb!&lt;BR /&gt;Glad I could help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;Nice solution!&lt;BR /&gt;&lt;BR /&gt;Henrique&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;@Anonymous&amp;nbsp;you're welcome!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; Thank you Henrique! Your solution looks impressive to me! Are there some benefits in this solution? What reason let you to provide such an advanced (at least to me) solution?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 12:22:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5963255#M135699</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-12-23T12:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5963447#M135700</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; Thank you Henrique! Your solution looks impressive to me! Are there some benefits in this solution? What reason let you to provide such an advanced (at least to me) solution?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;HI BeekeeCZ,&lt;/P&gt;
&lt;P&gt;I did use RegExp just to demonstrate a &lt;EM&gt;'&lt;/EM&gt;&lt;SPAN class="hps"&gt;&lt;EM&gt;simple'&lt;/EM&gt; way to deal with text case.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&amp;nbsp; &lt;A href="https://msdn.microsoft.com/en-us/library/ms974570.aspx" target="_blank"&gt;VBScript with Regular Expressions&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 15:09:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/5963447#M135700</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-12-23T15:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796538#M135701</link>
      <description>&lt;P&gt;Guys,&lt;/P&gt;
&lt;P&gt;Im not good in any of Lisp Coding, can some one help me modify this lisp that i have found on the internet.&lt;/P&gt;
&lt;P&gt;Its a good routine for replacing Old text to a new text.&lt;/P&gt;
&lt;P&gt;my problem is i've been trying to Put all the change/new text into Layer Dimension and Set the color by layer just in case the text color was assign with something else. with my attempt to change it (red text), the only&amp;nbsp; Text changing to Dimension layer is just the last Text on the list which is ("10" "273"). seem the selection by "Previous" is not selecting everything.&lt;/P&gt;
&lt;P&gt;Can you please help me to make it work. Many Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:FRTXT1 ( / _mapss old new SS )&lt;BR /&gt;(defun _mapss ( f s i / e ) (if (setq e (ssname s (setq i (1+ i)))) (cons (f e) (_mapss f s i))))&lt;BR /&gt;(foreach x&lt;BR /&gt;'(&lt;BR /&gt;;("OldText1" "NewText1")&lt;BR /&gt;;("OldText2" "NewText2")&lt;BR /&gt;;("OldText3" "NewText3")&lt;BR /&gt;; ...&lt;BR /&gt;("1" "33")&lt;BR /&gt;("2" "60")&lt;BR /&gt;("3" "89")&lt;BR /&gt;("4" "114")&lt;BR /&gt;("6" "168")&lt;BR /&gt;("8" "219")&lt;BR /&gt;("10" "273")&lt;BR /&gt;; ...&lt;BR /&gt;)&lt;BR /&gt;(and&lt;BR /&gt;(vl-every 'set '(old new) x)&lt;BR /&gt;(setq SS (ssget "_X" (list '(0 . "TEXT") (setq old (cons 1 old)))))&lt;BR /&gt;(_mapss (lambda (e / enx) (setq enx (entget e)) (entmod (subst (cons 1 new) old enx))) SS -1)&lt;BR /&gt;); and&lt;BR /&gt;); foreach&lt;BR /&gt;(princ)&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;(Command "change" "p" "" "p" "la" "Dimension" "")&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;(Command "setbylayer" "p" "" "n" "n")&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;); defun&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:37:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796538#M135701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T19:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796574#M135702</link>
      <description>&lt;P&gt;Try giving it the actual selection-set variable:&lt;/P&gt;
&lt;PRE&gt;(Command "change" &lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;SS&lt;/FONT&gt;&lt;/STRONG&gt; "" "p" "la" "Dimension" "")
(Command "setbylayer" &lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;SS&lt;/FONT&gt;&lt;/STRONG&gt; "" "n" "n")&lt;/PRE&gt;
&lt;P&gt;[Or, for the first one, save yourself a few characters:]&lt;/P&gt;
&lt;PRE&gt;(Command "ch&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;prop&lt;/FONT&gt;&lt;/STRONG&gt;" SS "" "la" "Dimension" "") &lt;/PRE&gt;</description>
      <pubDate>Thu, 16 May 2019 19:49:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796574#M135702</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-16T19:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796653#M135703</link>
      <description>&lt;P&gt;Hi Kent. Thanks for the quick reply. I'd copy the code but still I cant get the whole set on my list to change to dimension layer. it still the last part that is changing ("10" "273").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 20:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8796653#M135703</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T20:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text and mtext</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8799055#M135704</link>
      <description>&lt;P&gt;Hi Kent,&lt;/P&gt;
&lt;P&gt;Thank You Very much! SS actually works! I just need to place it on the right spot! Many Thanks Man!&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (_mapss (lambda (e / enx) (setq enx (entget e)) (entmod (subst (cons 1 new) old enx))) SS -1)&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;&lt;EM&gt;(Command "chprop" SS "" "la" "Dimension" "")&lt;/EM&gt; &lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ); and&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#ff0000"&gt;(Command "setbylayer" SS "" "n" "n")&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp;); foreach&lt;BR /&gt;&amp;nbsp;(princ)&lt;BR /&gt;); defun &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 21:19:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text-and-mtext/m-p/8799055#M135704</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-17T21:19:45Z</dc:date>
    </item>
  </channel>
</rss>

