How can I remove a date in the format of ##/##/#### from a string in Python?
Question: I have a text file that have strings that start with the date in the form of
##/##/#### and I want to remove the date and keep to work with the rest of the
text that is in that line. I have been look at regular expressions but cannot
figure out how to do this.


Answer: Regular expressions are a good way to go. If they're always in that format,
then the expression would be:

    
    
    \d{2}/\d{2}/\d{4}
    

Note that it doesn't check the validity of the date, i.e., months not 1-12,
etc. an example in python:

    
    
    import re
    expr = re.compile('\d{2}/\d{2}/\d{4}')
    line = re.sub(expr, '', input)  # replace all dates with ''
    

This solution would not work if your file contains strings like
"145/10/24045", as it would replace it with "15".

