fork download
  1. import re
  2. rx = r"^#(\d+(?:,\d+)?)\s*([^(]*)"
  3. s = "#31,456 in this category (Top 100 of category)"
  4. m = re.search(rx, s)
  5. if m:
  6. print("Group 1: {}; Group 2: {}".format(m.group(1), m.group(2)))
Success #stdin #stdout 0.02s 7092KB
stdin
Standard input is empty
stdout
Group 1: 31,456; Group 2: in this category