[Top] [Prev] [Next] [Bottom]


[Contents] [Index]

filepat - file pattern matching

Synopsis

include "filepat.m";
filepat:= load Filepat Filepat->PATH;

expand:   fn(pat: string)      : list of string;
match:    fn(pat, name: string): int;

Description

expand

expand: fn(pat: string): list of string;
## returns list of file names.
The expand function builds a list of file names in alphabetical order that matches the pattern pat. The pattern is tokenized using / as a delimiter.

match

match:fn(pat, name: string): int;
## returns 1 on match; 0 if no match.
The match function returns 1 if it matches the pattern pat. Otherwise, it returns 0.

The pat passed to match and each token of pat passed to expand may include combinations of the special characters *, ?, [, and ].

The asterisk * matches a string of zero or more characters.

The query ? matches any single character.

The notation [s], where s is a non-empty string, matches any single character in s. A range of characters can be expressed by a string s of the form cstart-cend. The notation [^s], where s is a non-empty string, matches any single character not in s. The characters *, ?, and [ lose their special meaning if they occur in s.

If any character is preceded by the character \, that character loses any special meaning and is interpreted literally.

See Also

readdir - read directory and sort files
tokenize - split string into words in Chapter 8


[Top] [Prev] [Next] [Bottom]

infernosupport@lucent.com
Copyright © 1997, Lucent Technologies, Inc.. All rights reserved.