fork(1) download
  1. import re
  2. text = '4.5 $55 1,200 wordA 3 sometext 2 wordB sometext 4.3charA sometext charB21.6 sometext 11/10/22'
  3. rx = r'(?<!\d)\d{1,2}/\d{1,2}/\d{2}(?:\d{2})?(?!\d)|\b(?:charB|wordA)\s*\d*[.,]?\d+|(?<!\d[.,])(?<!\d)(\d*[.,]?\d+)(?!\s*(?:wordB|charA)|[.,]?\d)'
  4. matches = re.findall(rx, text)
  5. print( [ m for m in matches if m ] )
Success #stdin #stdout 0.03s 9588KB
stdin
Standard input is empty
stdout
['4.5', '55', '1,200']