fork(2) download
  1. import re
  2. rx = r"\./([^\W_]+)_word1_([0-9.]+)_([0-9.]+)_([0-9]+(?:\.[0-9]+)*)"
  3. s = "./test1_word1_1.1_1.2_1.3.csv"
  4. m = re.search(rx, s)
  5. if m:
  6. print("Part1: {}\nPart2: {}\nPart3: {}\nPart4: {}".format(m.group(1), m.group(2), m.group(3), m.group(4) ))
Success #stdin #stdout 0s 23352KB
stdin
Standard input is empty
stdout
Part1: test1
Part2: 1.1
Part3: 1.2
Part4: 1.3