def validate_names(self, category_name, probe_name):
        """Validate the category and probe name:
            - Category name must be alpha-numeric + '.', no leading/trailing digit or '.'.
            - Probe name must be alpha-numeric + '_', no leading/trailing digit or '_'.

        :param category_name: the name of the category the probe is in.
        :param probe_name: the name of the scalar probe.
        :raises ParserError: if the length of the names exceeds the limit or they don't
                conform our name specification.
        """

        # Enforce a maximum length on category and probe names.
        MAX_NAME_LENGTH = 40
        for n in [category_name, probe_name]:
            if len(n) > MAX_NAME_LENGTH:
                raise ParserError(("Name '{}' exceeds maximum name length of {} characters.\n"
                                   "See: {}#the-yaml-definition-file")
                                  .format(n, MAX_NAME_LENGTH, BASE_DOC_URL))

        def check_name(name, error_msg_prefix, allowed_char_regexp):
            # Check if we only have the allowed characters.
            chars_regxp = r'^[a-zA-Z0-9' + allowed_char_regexp + r']+$'
            if not re.search(chars_regxp, name):
                raise ParserError((error_msg_prefix + " name must be alpha-numeric. Got: '{}'.\n"
                                  "See: {}#the-yaml-definition-file").format(name, BASE_DOC_URL))

            # Don't allow leading/trailing digits, '.' or '_'.
            if re.search(r'(^[\d\._])|([\d\._])$', name):
                raise ParserError((error_msg_prefix + " name must not have a leading/trailing "
                                   "digit, a dot or underscore. Got: '{}'.\n"
                                   " See: {}#the-yaml-definition-file").format(name, BASE_DOC_URL))

        check_name(category_name, 'Category', r'\.')
        check_name(probe_name, 'Probe', r'_')