pattern = '[A-Za-z][\\-A-Za-z0-9_:\\.]*$'
compiled = re.compile(pattern)

def validate(id):
    return bool(compiled.match(id))
print(validate(id_value1))
print(validate(id_value2))
HTML ID value validation by RE