I just started looking into regular expressions, and was wondering what the difference is between the following:
def test():
string = "He was 75 in the 1985sdfdhs 45"
y = re.findall('[0-9]+', string)
print(y)
test()
and this
def test2():
string = "He was 75 in the 1985sdfdhs 45"
y = re.findall('[0-9.]+', string)
print(y)
test2()
To my understanding the "." matches any character, so I would have thought the output for test2 would equal ['75', '1985sdfdhs', '45'], instead they are both ['75', '1985', '45']. Just trying to figure out whats going on here. Thanks.