fork download
  1. import re
  2. texts = ['0.0.4.1','7.51.4.1','0.1.4.1', '0.0.0.0']
  3. for text in texts:
  4. m = re.fullmatch(r'(?:0+\.)*(\d+(?:\.\d+)*)', text)
  5. if m:
  6. if m.group(1).replace('0',''):
  7. print(m.group(1))
Success #stdin #stdout 0.03s 9388KB
stdin
Standard input is empty
stdout
4.1
7.51.4.1
1.4.1