fork(1) download
  1. import re
  2. text = '''localhost,127.0.0.1
  3. 8.8.8.8;web
  4. web2 # Comments
  5. 192.168.0.1,fw'''
  6. print ([x for x in re.findall(r'#.*|([\d_]*[A-Za-z]\w*)', text) if x])
Success #stdin #stdout 0.02s 9464KB
stdin
Standard input is empty
stdout
['localhost', 'web', 'web2', 'fw']