import re
regex = re.compile(r"\+[\d]{11,14}", flags=re.IGNORECASE)
test_str = ("Иванов Иван иванович !@#$%^&*(_+1234567890-=[]?/\n"
"IVANOV Ivan ivanovich !@#$$^&*(_+1234567890-=~`:\"{};'[]|\\<>?,./\n"
"IVANOV Ivan !@#$$^&*(_+1234567890-=~`:\"{};'[]|\\<>?,./\n"
"+9991234567\n"
"+19991234567\n"
"+129991234567\n"
"+1239991234567\n"
"+12349991234567\n"
"+1 999 1234567\n"
"+1234 (999) 123-45-67\n")
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