##Python, 75 bytes <!-- language-all: lang-python --> lambda s:eval("s"+(".replace('%s','')"*4%('[]','()','{}','<>'))*len(s))=='' Generates and evals an expression that looks like s.replace('[]','').replace('()','').replace('{}','').replace('<>','').replace('[]','').replace('()','').replace('{}','').replace('<>','') and checks if the result is empty. Using `re.sub` came close (75 bytes). I didn't see a nice way to put it in a `lambda`, either recursively or via an eval chain. import re def f(s): for _ in s:s=re.sub('{}|<>|\(\)|\[\]','',s) return''==s