>Can you have brackets within brackets? If so, this is impossible to deal >with within a regex.
Nope. It's a regular language, not a CFL. >Otherwise: >>>> re.findall('((?:[^[:]|\[[^]]*\])*):?',s) >['foo.[DOM]', '', '[IP6::4361:6368:6574]', '600', '', ''] That seems to do it, thanks. -- Regards, John Levine, jo...@iecc.com, Primary Perpetrator of "The Internet for Dummies", Please consider the environment before reading this e-mail. http://jl.ly -- http://mail.python.org/mailman/listinfo/python-list