def get_inc_version()

in src/es_pii_tool/helpers/utils.py [0:0]


def get_inc_version(name: str) -> int:
    """Extract the incrementing version value from the end of name

    :param name: The name

    :type name: str

    :returns: The integer value of the current index revision, or 0 if no version
    :rtype: int
    """
    # Anchor the end as 3 dashes, a v, and 3 digits, e.g. ---v001
    match = re.search(r'^.*---v(\d{3})$', name)
    if match:
        return int(match.group(1))
    return 0