TclSourceFilter -- Extract blocs mathing a regexp from a script


TclSourceFilter name | %AUTO%

name SetValidPatterns pattern-list

name Filter tcl-script-fragment


Provides a mechanism to extract script blocks that match a list of regular expressions.


SetValidPatterns pattern-list

Sets the regular expressions that will be matched to pattern-list. pattern-list is a valid Tcl list whose members are regular expressions.

Filter tcl-script-fragment

Returns a list of strings. For each valid Tcl command block in the string tcl-script-fragment, if that block matches against at least one of the regular expressions established by SetValidPatterns, the content of that block (sans any outer braces) is added to the return value list.

The result of this command is a list whose elements are the contents of the matching blocks. An empty list is, of course, a possible return value.