Returns 1 if a string matches a pattern, including case.
Usage
strmatch(pattern, s)
Notes
This function is case-sensitive. For case-insensitive matches, use strcasematch.
Returns 1 if any patterns in the pattern string matches string s, or 0 if no patterns match.
In order to match, a pattern must match the s string from beginning to end. Use wildcards (
*) to match substrings, e.g.strmatch("bar", "foobarbaz") = 0 strmatch("*bar*", "foobarbaz") = 1pattern is a space-separated list of one or more patterns. This can cause unintuitive behavior of this function. For example:
strmatch("foo bar", "foo bar")...will return 0, because the first argument consists of two patterns,
fooandbar, and neither of those patterns matchfoo bar(since the pattern must match from beginning to end).Similarly,
strmatch("foo bar", "foo")...will return 1, because the string matches the first of the two arguments in the pattern (
fooandbar).
Examples
strmatch("foo*", "foobar") = 1strmatch("?bar", "fred") = 0strmatch("foo*,bar*", "bar") = 1