fork download
  1. import re
  2. text = "§s 23, 12"
  3. print(re.sub(r\w*\s+\d+(?:,\s*\d+)*', lambda x: re.sub(r'\s+', '_', x.group()), text))
Success #stdin #stdout 0.03s 9616KB
stdin
Standard input is empty
stdout
§s_23,_12