Houdini 11 Expression functions

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") = 1
  • pattern 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, foo and bar, and neither of those patterns match foo 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 (foo and bar).

Examples

strmatch("foo*", "foobar") = 1
strmatch("?bar", "fred") = 0
strmatch("foo*,bar*", "bar") = 1

On this page

Related topics