CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor and other Autodesk products []
Cesky English Deutsch
 Visitors: 3756 
Plex.Earth connects AutoCAD and Google Earth

CAD tip CAD tip # 3714:

Question CAD 
 %  platform  category 
Q - question

How to replace only a single occurrence of a substring in a drawing text?

A - answer You can use the srxText LISP utility and regular expressions to replace only the first occurrence of a substring - e.g.:

search: \(.\)oldtext\(.\)
replace: \1newtext\2

will change

myoldtext1andoldtext2 -> mynewtext1andodltext2
For srxText see
100% *  CAD 
6.4.2004    4759x  
Comments   Tell a friend
applies to: AutoCAD · AutoCAD Architecture · MDT · AutoCAD Map ·

See also:
Tip 9265:RENAME on steroids - complex renaming of AutoCAD objects.
Tip 7892:How to find blocks with an empty (not-filled-in) attribute?
Tip 7890:How to find missing numbers in a series of numbered blocks?
Tip 7673:How to search/replace tabs in texts?
Tip 7241:Searching text in DWG drawings (without AutoCAD).

Back   All CAD Tips All CAD tips&tricks

Where is the 'convert polyline to wall' command in Architectural Desktop 2004 and 2005? « | » Font style does not offer Italic or Bold style.

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   

Add .CIT raster format support to AutoCAD and Map and Civil 3D
CITin More info

Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.