Imagix 4D User Guide

Appendix D. Forms of Pattern Matching

Various features in the Imagix 4D user interface, such as the Data Source dialog, the Grep Search tab and the Filter/Add dialog, use pattern matching to identify strings or names matching user-specified patterns. Generally, these features support glob-style pattern matching, which applies the rules used by Unix shells for file name expansion. The exception is the Grep Search tab, where regular expression pattern matching is used, applying the rules used by the Unix regexp command.

Glob-style Pattern Matching

A glob-style pattern may contain any of the following special characters:

?Matches any single character.
*Matches any sequence of zero or more characters.
[chars]Matches any single character in chars. If chars contains a sequence of the form a-b then any character between a and b (inclusive) will match.
\xMatches the character x.

Regular Expression Pattern Matching

Regular expression matching uses the following rules in determining matching patterns.

A regular expression is zero or more pieces, concatenated. It matches a match for the first, followed by a match for the second, etc.

A piece is an atom possibly followed by *, +, or ?. An atom followed by * matches a sequence of 0 or more matches of the atom. An atom followed by + matches a sequence of 1 or more matches of the atom. An atom followed by ? matches a match of the atom, or the null string.

An atom is a regular expression in parentheses (matching a match for the regular expression), a range (see below), . (matching any single character), ^ (matching the null string at the beginning of the input string), $ (matching the null string at the end of the input string), a \ followed by a single character (matching that character), or a single character with no other significance (matching that character).

A range is a sequence of characters enclosed in [ ]. It normally matches any single character from the sequence. If the sequence begins with ^, it matches any single character not from the rest of the sequence. If two characters in the sequence are separated by -, this is shorthand for the full list of ASCII characters between them (e.g.[0-9] matches any decimal digit). To include a literal ] in the sequence, make it the first character (following a possible ^). To include a literal -, make it the first or last character.