fork(1) download
  1. import re
  2. p = re.compile("[0-9]*(?:\\.[0-9]+)?[^0-9]*D\\([MW]\\)\\s*US")
  3. test_str = "9.5 D(M) US"
  4. print re.search(p, test_str).group()
Success #stdin #stdout 0.01s 7692KB
stdin
Standard input is empty
stdout
9.5 D(M) US