import re
from typing import Tuple


def parse_version_string(name: str) -> Tuple[str, str]:
  """Parse a version string (name ID 5) and return (major, minor) strings.

  Example of the expected format: 'Version 01.003; Comments'. Version
  strings like "Version 1.3" will be post-processed into ("1", "300").
  The parsed version numbers will therefore match in spirit, but not
  necessarily in string form.
  """

  # We assume ";" is the universal delimiter here.
  version_entry = name.split(";")[0]

  # Catch both "Version 1.234" and "1.234" but not "1x2.34". Note: search()
  # will return the first match.
  version_string = re.search(r"(?: |^)(\d+\.\d+)", version_entry)

  if version_string is None:
    raise ValueError("The version string didn't contain a number of the format"
                     " major.minor.")

  major, minor = version_string.group(1).split('.')
  major = str(int(major))  # "01.123" -> "1.123"
  minor = minor.ljust(3, '0')  # "3.0" -> "3.000", but "3.123" -> "3.123"
  return major, minor