fork download
  1. import re
  2.  
  3. pattern = r"(?<!\S)\d+\b(?!€|\.\d)"
  4. s = ("I have the following products 4526 and 4. The first one I paid $40 while the second one 30€. \n"
  5. "Here the link for the discount of 3.99: https://w...content-available-to-author-only...d.coom/7574@5757\n")
  6.  
  7. print(re.findall(pattern, s))
Success #stdin #stdout 0.02s 9488KB
stdin
Standard input is empty
stdout
['4526', '4']