Function matchWildcard

  • Matches a string against a wildcard pattern.

    Parameters

    • str: string

      String to match

    • pattern: string

      Wildcard pattern

    Returns boolean

    True if the string matches the wildcard pattern

    Example

    matchRule('foo123', 'foo*') // true
    matchRule('123foo123', '*foo*') // true