I thought this would have been simple, but after 3hrs of trying multiple different re.sub combinations, the answer is still eluding me.
I have the following string:
a = "99999 Anywhere Dr., Roanoak, VA 88888, ,"
I'd like to remove everything between the 88888 and the ending " (note there could be other characters other than space and comma, but there won't be another string of 5 digits after the 88888). I tried many combinations but the closest I got to what I was trying to accomplish was:
re.sub('(?=>\d{5})(.*)\".*$','',a)
This results in "99999" since it doesn't look from the end of the string but instead deletes everything after the first occurrence of the 5 digits. I want the result to be:
"99999 Anywhere Dr., Roanoak, VA 88888"
Thank you