Cold Help System: General Information: Commands: Matching Conventions


Two types of general matching systems are used in Cold. The base matching system is pattern matching. The asterisk character ('*') in a pattern match is used to represent a wildcard. It can be placed anywhere in the pattern. It tells the interpreter that when matching the pattern with a string, anything can match the wildcard. This becomes useful for matching different strings. Some examples:

Pattern:           "match *"
String:            "match anything after this"
Wildcard Match:    "anything after this"

Pattern:           "match *t not this"
String:            "match only this but not this"
Wildcard Match:    "only this bu"

Template matching expands upon the basic idea of pattern matching. Template matching is a little smarter about matching. It recognizes words as anything bounded by spaces or the beginning and end of the string. In a template the wildcard must be its own word--it must have spaces around it. Templates also add two more special characters; the question mark ('?') for optional matching and the pipe character ('|') for multiple matches.

If a question mark is placed within a word, it means that the word must match up to the point of the question mark, but everything after that point is optional. For instance, all of the following would be valid against the specified template:

Template:          "th?is"
String:            "th"
String:            "thi"
String:            "this"

The pipe character (|) is used to specify several different words that can match the place of one. For instance, the template "this|that|there" would match "this" OR "that" OR "there". It is easiest to logically think of the pipe character as OR. With these elements drawn together you get a simple yet dynamic matching system. Some full template examples:

"l?ook at *"
"give|put * to|in *"
"@who *"
"@lock * to|with *"


VR vs Non-VR | Types | Matching Conventions


the Cold Dark