import re
regex = re.compile(r"^[^-]*-[^-]*\K.*$", flags=re.IGNORECASE | re.MULTILINE)
test_str = ("60166213\n\n"
"60173866-4533\n\n"
"60167323-9439-1259801\n\n"
"NL170-2683-1262201\n\n"
"60174710-1-A12-4")
subst = ""
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