I discovered recently that it is possible to use regular expressions in the purge command. If that doesn’t excite you, I don’t know what will.
A regular expression is a way to define a pattern. The pattern can be used to include or exclude the name(s) of a layer, linetype, registered application, or anything that can be purged. You need to use the command line version of purge (prefix the command with a minus sign: -PURGE). Here’s how it looks:
Command: -PURGE
Enter type of unused objects to purge
[Blocks/Dimstyles/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/textSTyles/Mlinestyles/Tablestyles/Visualstyles/Regapps/All]: Regapps
Enter name(s) to purge <*>: ~[s|p]*
In this example I’m purging all registered applications that don’t start with “s” or “p”. The ~ symbol means “not”, and the | symbol means “or”. The * is a wildcard that means that any character(s) will be matched. If you want to brush up on regular expressions, try this site.
I haven’t tried them all, but here are a few that worked, for example:
E[~P]* – match all names that start with E followed by any letter but P
*_* – match all names that contain an underscore character.
~[0-9]* – purges all names that do not start with a number.
Note that you don’t need to escape (prefix with a backslash) the underscore character. In fact, I don’t think any of the escape sequences work. It may be disingenuous to call these regular expressions, because many of the standard features of regular expressions won’t work. Only the most basic pattern-matching functions can be used. But that alone may be a useful tool for you.
