fork(1) download
  1. import re
  2. str = "4,5cm x55x 22cm ";
  3. regex = "(?P<l>[\d|,]+)(.*?)x(.*?)(?P<w>[\d|,]+)(.*?)x(.*?)(?P<h>[\d|,]+)(.*?)"
  4. resultado = re.match(regex, str)
  5. print resultado.groupdict()['l']
  6. print resultado.groupdict()['w']
  7. print resultado.groupdict()['h']
Success #stdin #stdout 0.02s 6876KB
stdin
Standard input is empty
stdout
4,5
55
22