fork download
  1. import re
  2. rx = r"(\s|^)([\d,|.]+(?:\.\d{2})?)(?=$|\s)"
  3. 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>"
  4. print(re.findall(rx, s))
Success #stdin #stdout 0.02s 27728KB
stdin
Standard input is empty
stdout
[(' ', '200,'), (' ', '200.99,'), (' ', '300,555')]