Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

gmatch string string

gmatch is NOT undoable, NOT queryable, and NOT editable.

Returns a non-zero result if the pattern specified by the second argument matches the search string in the first argument. gmatch provides shell-style pattern matching, also known as "glob" matching. There are three ways to specify wild cards in this type of matching and they are as follows:
* matches any string
? matches any single character
[...] Matches any one of the enclosed characters. A pair of characters separated by - matches any character lexically between the pair, inclusive. If the first character following the opening "[ " is a "!" any character not enclosed is matched. A - can be included in the character set by putting it as the first or last character.

Return value

int Matching value

Related

match, strcmp

MEL examples

gmatch "matches" "m*s";
// Result: 1 //
gmatch "matches" "mat*";
// Result: 1 //
gmatch "matches" "ma[a-z]ches";
// Result: 1 //
gmatch "matches" "ma[!a-m]ches";
// Result: 1 //
gmatch "matches" "ma?ches";
// Result: 1 //
gmatch "no match" "?atch";
// Result: 0 //