import rem='5167170011843850 1234 745'print(re.findall(r"\b\d{3,4}\b", m))
Standard input is empty
['1234', '745']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!