import re
regex = re.compile(r"(^[^;]*|\G)[;\h]*(\b\d+|$)", flags=re.MULTILINE)
test_str = ("Name-6.1.4_Float Time;453802;464204;466345 464481 466131 464283 465065 462561\n"
"Name-6.1.4_Logic Good Time;125896;145349;137303 131601 144520 132487 133884")
subst = "$1;$2"
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html