import res = '200 word1 some 50 foo and 5foo 30word2'pattern = r"\b[0-9]+(?!\s*foo|[0-9])"print(re.findall(pattern, s))
Standard input is empty
['200', '30']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!