Next: match_regexp

Prev: match_begin

match_pattern

match_pattern(pattern, string)
This function matches the wildcard pattern pattern against string. A wildcard pattern is a string with asterixes (*) signifying wildcards. A regular character matches itself, while a wildcard matches any number of arbitrary characters. The return value of match_pattern() is a list of the substrings of string which matched the wildcards in pattern, or 0 if the match fails.

match_pattern() allows you to do simple character-based matching. For matching against command formats, however, you should use the match_template() function.

Examples:

match_pattern("*", "foobar")
     => ["foobar"]
match_pattern("foo * bar * baz", "foo quux bar quuux baz")
     => ["quux", "quuux"]
match_pattern("foo * bar", "baz")
     => 0