The Pattern Builder Widget

Functions

The Pattern Builder is used to specify regular expressions. It is most useful when certain file name patterns are to be specified as part of commands. Using this widget, even a user who has no knowledge of Unix regular expression syntax can specify complex regular expressions. There's no need to worry about having to 'escape' special characters when they themselves occur in patterns. The widget inserts the backslashes or quotes automatically.

Screenshots

Here is an example of the Pattern Builder at work, called from a hypothetical Pattern Holder, which could be any widget that needs a regular expression.

In the example above, the user wants to name all C and C++ source files (whose extensions are .c and .C, respectively). The sequence of steps to be followed is illustrated, and the widget builds up the expression *.[cC].

The user must mentally break up the pattern into smaller units, each of which may then be specified using one of the options provided as radio buttons. The next unit is signalled using the Next button, which results in an almost identical instance of the Pattern Builder appearing to the right of the existing one. This may be continued ad infinitum, until the pattern is fully specified. At this point, the Done button is pressed.

In case an expression is itself made up of "sub-expressions", the Pattern Builder may be nested by calling itself through the Build button. Another instance of it pops up, but not to the immediate right of the existing "train". When the sub-expression is fully specified and the Done button is pressed, control returns to the original train. The built-up sub-expression appears in the dropdown list of the calling widget.

Supporting Free Software

This page hosted by Get your own Free Home Page
1