CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 7982

CAD tip CAD tip # 14163:

   
Question CAD 
 %  platform  category 
Q - question

How to select DWG texts containing a certain number of characters?

A - answer If you want to find and select all texts in your AutoCAD drawing that contain a certain number of characters, you can use e.g. the command FILTER or a LISP add-on application.

In the FILTER command, choose the filter "Text, value" and as the text value, type wildcard characters, e.g. "????". Then select texts using this filter. Only those texts with 4 characters will stay selected.

Another way, with more advanced options, is the LISP add-on app srxText (see Download) for processing regular expressions, and its option Select. After loading the app (APPLOAD), type the command SRXTEXT2 and the following options:

Pøíkaz: SRXTEXT2
Search texts using [Regular expression/Exact string/Substring] : R
Enter the searched pattern: ^.{4}$
Enter the replace pattern ($1$2 for regex captures):
(no replacements will be performed)
Search only in [Layer/All] :
Search only [Selected/All] :
Number of searched entities: 53
yes
Perform [Skip/skipAll/seLect/Exit]? : L
yes
123
big
red
Number of found/replaced entities: 4/0

Just texts with exactly 4 characters will stay selected.

Other examples of regular expressions for this purpose:

^\w{3,5}$

texts with 3 to 5 word characters

^\d{6,}$

texts with 6 or more digits.

Both tools may have a problem with formatted paragraph texts, because their text strings may contain formatting characters and codes.

ACADACADMPlantCivil3DACADE
100% *  CAD 
4.7.2024    708×  

See also:
Tip 13831:ReplMTcol - recoloring parts of text in paragraph Mtext.
Tip 13139:How to insert a new line into multiline text in the Find/Replace command?
Tip 12803:How to add double line-spacing to AutoCAD paragraphs?
Tip 9265:RENAME on steroids - complex renaming of AutoCAD objects (blocks, layers...)
Tip 8065:How to add prefix or suffix to selected drawing texts?


Back   All CAD Tips



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   



Featuring:
DwgTextTranslator translates a series of drawings from one language to another using MS Access.
Download a fully functional trial version.


Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist