I have some text, a block with address and phone numbers, that looks like:
import re
text = 'John Doe Inc - Real Estate Brokers\n1234 Shaky Bridge Road, '\
'\n Suite 123, \nDallas, TX 12345\n\nTel: 123-456-7890\n\t\t'\
'\n\t\tCell: 234-567-8901'
I just want to keep everything before "Tel:
" (i.e. the address, not the phone numbers).
I tried removing "Tel:
" and everything after it.
re.sub('Tel:.*','',text)
# Returns:
# 'John Doe Inc - Real Estate Brokers\n1234 Shaky Bridge Road, \n Suite 123, \nDallas, TX 12345\n\n\n\t\t\n\t\tCell: 234-567-8901'
However, this only removes "Tel: 123-456-7890
". The substring that is removed does not extend through the end of the string.
Why is that, and how can I fix it?