import rerx = r"(\s|^)([\d,|.]+(?:\.\d{2})?)(?=$|\s)"s = "I would like to replace a number with one of the following formats: 200, 200.99, 300,555 unless its between the <> tokens. for example I would like to skip this: <200>"print(re.findall(rx, s))
Standard input is empty
[(' ', '200,'), (' ', '200.99,'), (' ', '300,555')]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!