osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re not working


For some reason these are different:

pattern = r'[0-9]{4,6}'

And

pattern2 = r'[0-9][0-9][0-9][0-9]([0-9]){0,2}'

And when I try to match them

import re
re.search(pattern, '1234')

and

import re
re.search(pattern2, '1234')

are different. Help?