Using Wildcards in the FIND and Replace in AutoCAD
Since my last Blog was about Text features in AutoCAD, I recently got a support request from one of our clients that made us have to stop and scratch our heads for a minute on the capabilities of using the Find/Replace command with wildcards in AutoCAD. It seemed that in some cases the text would not me found and in others we would lose valuable information. So, after several trial and errors we finally were able to get the command to accomplish what the client needed (and after losing a few hair follicles along the way too!). So I thought this was a perfect time to add to last month’s Blog; so I wanted to share my findings with you…
First let me set the stage of what the customer wanted to do.
They had an AutoCAD Structural drawing with Mtext calling out the member sizes and some of them with the quantities if there were multiple beams, obviously to avoid unnecessary duplication and better drawing clarity. The naming convention was standard (i.e. W12X18 ) which denotes a Wide-flange beam 12” by 18” and a total count of 24 beams and so on.
Mission: The drawing consisted of hundreds of beam callouts that needed to be modified to only show the quantities and not the beam size. But beams without quantities needed to be left alone.
Note: This is a super small portion of the drawing just to show an example.
Solution: Find and Replace with Wildcards. Now the trick only works character by character, so with that said there are differences in the text (example. W8X16 Vs W16X24 has a different number of place holders.) And some of the callouts do not include a quantities so we don’t want to lose those callouts either, so logically we will have to work through several steps to address each scenario, as well as there are certain other things to be aware of to avoid making mistakes that the user could be unaware of.
Operation: In AutoCAD enter the FIND command, the FIND and Replace Dialog if you type in the following bold text in the Find field box.
The results will find anything that starts with a W and any single character after (The 2nd Character place holder) and the 3rd character has to be an X, then it will accept any characters after, but only the next 2 characters that follow the X will remain if you replace with nothing. (Meaning a voided blank box, not even a space) in the Replace field. Below I created a Matrix Chart and summary for the client so they can easily; know what to enter in the find and know what the results of the changes would be.
With FIND, you can use several wild-card characters to broaden your search. Here is a list of the Character’s and their Definitions…
Matches any numeric digit
Matches any alphabetic character
Matches any nonalphanumeric character
Matches any string and can be used anywhere in the search string
? (Question mark)
Matches any single character; for example, ?BC matches ABC, 3BC, and so on
Matches anything but the pattern; for example; ~*AB*matches all strings
that don’t contain AB
Matches any one of the characters enclosed; for example, [AB]C matches
AC and BC
Matches any character not enclosed; for example, [~AB]C matches XC but
Specifies a range for a single character; for example, [A-G]C matches
AC, BC, and so on to GC, but not HC
` (Reverse quote)
Reads the next character literally; for example, `~AB matches ~AB
I hope this is useful information for you. I know that the Find command is one of the commands that most people forget about… So the next time you need to change a lot of text in your AutoCAD drawing, and if you know these tricks, it will drastically speed up the process… Now that is a FIND!!!