import re


def _version_from_tag(tag):
    """
    Extracts the semver from the given tag (e.g: v0.1.0 -> 0.1.0)
    :param tag:
    :return:
    """
    pattern = re.compile('v\d+.\d+.\d+')
    if not pattern.match(tag):
        raise Exception(f"{tag} is not valid semver")
    return tag[1:]