Training   Course Outlines   AutoCAD – The Basics   AutoCAD – Beyond the Basics   AutoCAD – 3D Basics   On‑Site Training   Virtual Classroom Training   CAD Bytes Webinars › Tutorials

Click the subscribe button below to receive CCAD's monthly email newsletter, which includes free tutorials, discounts and our class schedule!

CCAD's AutoCAD Tutorials

Wildcard Patterns

Wildcards are used to specify a list of names, like layer names and block names. Most AutoCAD users are familiar with the typical wildcards used, * (asterisk) and ? (question). For instance, if you want to turn off all the layers beginning for the characters DIM in the drawing, select the LAYER command (-Layer in 2000 and up), then the OFF option. Type DIM* to specify all layers to be turned on.

The * can be combined with other characters to specify a subset of names. Below is an explanation that illustrates some uses of the *.

Pattern Matches Does Not Match
FLOOR* all names beginning with FLOOR and ending with any combination of characters
FLOOR1, FLOOR2, FLOOR
names not beginning with FLOOR
BASEFLOOR, 1FLOOR, HVAC
*FLOOR* all names that include FLOOR anywhere
FLOOR1, BASEFLOOR, 2FLOOR-23
names that do not include FLOOR
HVAC, BASEMENT

There are ten wildcard characters that can be used to specify names.

# (pound)
matches any numeric digit
@ (at)
matches any alpha character
. (period)
matches any non-alphanumeric character
* (asterisk)
matches any string, including the null string
? (question mark)
matches any single character
~ (tilde)
matches anything but the pattern
[...]
matches any one of the characters enclosed
[~...]
matches any character not enclosed
- (hyphen)
used inside brackets to specify a range for a single character
' (reverse quote)
escapes special characters (reads the next character literally)

Let's look at this list of layer names in a drawing:

0
Floor2elec
Basement
Floor3
Elecservice
Floorelec
Floor1
Floor4
Floorelec

Please note that the Wildcard Patterns are NOT case sensitive.

The pattern FLOOR* returns FLOOR1, FLOOR2, FLOOR3, FLOOR4, FLOOR1ELEC, FLOOR2ELEC, FLOOR3ELEC and FLOOR4ELEC.

The pattern FLOOR? returns FLOOR1, FLOOR2, FLOOR3 and FLOOR4.

The pattern FLOOR[13] returns FLOOR1 and FLOOR3.

The pattern *ELEC returns FLOOR1ELEC, FLOOR2ELEC, FLOOR3ELEC and FLOOR4ELEC.

The pattern ELEC* returns ELECSERVICE.

The pattern *ELEC* returns ELECSERVICE, FLOOR1ELEC, FLOOR2ELEC, FLOOR3ELEC and FLOOR4ELEC.

The pattern FLOOR[1-3] returns FLOOR1, FLOOR2 and FLOOR3.

The pattern ~FLOOR* returns 0, BASEMENT, ELECSERVICE and WALLS.

The pattern FLOOR[1-3]* returns FLOOR1, FLOOR2, FLOOR3, FLOOR1ELEC, FLOOR2ELEC and FLOOR3ELEC.

Summary:
When AutooCAD requests a name, frequently a group of names can be specified using a wildcard pattern. Layers, blocks, linetypes, attributes and files are some of the names that recognize wildcards. You can use wildcard patterns in the QSELECT command and when creating Layer Property Filters in the Layer Property Manager.