import re


def _validcas(cas):
    """
    Validate a CAS Registry Number
    See: https://en.wikipedia.org/wiki/CAS_Registry_Number#Format
    :param cas: a string to be validated as a CAS Registry Number
    :return: bool
    """
    test = re.search(r'^\d{2,8}-\d{2}-\d$', cas)
    # if format of string does not match then it's not CAS RN
    if test is None:
        return False
    # verify check digit
    reverse = cas[::-1]  # reverse the CAS Registry Number (needed for checksum math and split out checksum)
    digits = reverse.replace('-', '')  # remove the dashes
    nochk = digits[1:]  # all but first digit
    chksum = int(digits[:1])  # first digit
    total = 0
    for i, digit in enumerate(nochk):
        total += (i + 1) * int(digit)  # index of chars starts at 0
    newsum = total % 10
    if newsum == chksum:
        return True
    else:
        return False