I have the following regular expression:
>>> re.findall(r'\r\n\d+\r\n',contents)[-1]
'\r\n1621\r\n'
>>> re.findall(r'\r\n\d+\r\n',contents)[-1].replace('\r','').replace('\n','')
'1621'
How would I improve the regular expression such that I don't need to use the python replace
methods?
Note that the digit must be surrounded by those characters, I can't do a straight \d+
.