shell_match

shell_match — compares string text to a pattern.

Syntax

shell_match (text, pattern)

		

Arguments

text

A text string to compare against the given pattern.

pattern

A shell style pattern.

Returns

t if the text matches the pattern, otherwise nil.

Description

This function compares the text to the pattern using shell-style wildcard rules. The available patterns are as follows:

    matches any number of characters, including zero.

    [cmatches a single character which is a member of the set contained within the square brackets.

    [^cmatches any single character which is not a member of the set contained within the square brackets.

    matches a single character.

    {xx,yymatches either of the simple strings contained within the braces.

    \c (a backslash followed by a character) - matches that character.

Example

To get a directory listing of just *.txt files, use:

shell_match(directory("/etc/readme",0,nil),"*.txt");
Gamma> shell_match("hello","?el[a-m]*");
t
Gamma> shell_match("hello","hel{p,m,ga}");
nil
Gamma> 
		

See Also

apropos