fork download
  1. import re
  2. pat = r"COALESCE\((.*?)\)"
  3. s = "select DISTINCT SUM(case when t0_0.pp is not null then COALESCE(t0_0.pp,0)\nelse 0 end) from inventory_coverage_view t0_0 where LOWER(t0_0.h) ='vg' AND t0_0.id = '9'"
  4. m = re.search(pat, s)
  5. if m:
  6. print(m.group(1))
  7.  
Success #stdin #stdout 0.01s 23304KB
stdin
Standard input is empty
stdout
t0_0.pp,0