Wildcards and Regular Expressions

Feature name masks and object name masks, which are used extensively in the Civil View style editor panels, are generally expressed using wildcards. Regular expressions extend the wildcard concept: They are strings that describe sets of strings.

Wildcards

A wildcard is a text string that uses special wildcard characters to substitute for any other character or characters in a string.

Special Wildcard Characters

The asterisk (*) usually substitutes as a wildcard character for zero or more characters.

The question mark (?) usually substitutes as a wildcard character for any single character.

Wildcard Examples

Examples of valid wildcard expressions are as follows:

  • MC* Select strings of any length that begin with the characters "MC".
  • *01 Select strings of any length that end with the characters "01".
  • AF?1 Select any four-character string that starts with "AF" and ends with the numeral "1".
  • ?D* Select strings of any length where the second character is "D".

Regular Expressions

A regular expression is a text string that describes a set of strings. Regular expressions ("regex") are useful as a way to search for patterns in text strings. They provide more power than wildcards do. In fact, you can think of regular expressions as wildcards on steroids. A wildcard expression such as "*.txt" to find all text files in a file manager would become ".*\.txt" as a regular expression.

Civil View uses regular expressions in the civilview.cfg file, which holds default settings to define the wirecolor and material ID settings that are applied to objects imported from LandXML files, 12D ASCII files, GENIO files, and MX model files. The civilview.cfg file is saved in the /plugcfg folder (there is a copy of this folder for each of the languages used by 3ds Max).

The power of regular expressions is endless, and outside the scope of this documentation. For more detailed information on regular expressions and for a library of examples of typical regular expressions, refer to the following links:

http://www.regular-expressions.info/

http://www.regular-expressions.info/tutorial.html