import reres = re.findall(r'^foo (\S+(?:\s+\S+)*) (\S+) baz (\d+)', 'foo hello hello hello baz 33')print(res)
Standard input is empty
[('hello hello', 'hello', '33')]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!