@classmethod
def bnMatchName(cls, pattern, name):
    """Check if a *name* matches a given pattern.

        Both pattern and *name* must be strictly well-formed.

        If the same pattern is to be matched several times, consider using
        :meth:`MGlobal.bnMakeMatchNameFunction` instead.

        Categories: :term:`explicit`.

        Parameters
        ----------
        pattern : str
            Pattern to match to. Wildcards are allowed.
        path : str
            *Name* to check.

        Returns
        -------
        bool
            ``True`` if the *name* matches the given pattern.

        See Also
        --------
        :ref:`pattern_matching`, :meth:`MGlobal.bnIsValidName`.
        """
    if not cls.bnIsValidName(name):
        raise ValueError("The name pattern '%s' is not valid." % (name,))
    return bool(cls.bnMakeMatchNameFunction(pattern)(name))
