<?php $a = 'hello,[how]. please don\'t remove[are]you?'; echo preg_replace('#\s*\[.+\]\s*#', ' ', $a); echo preg_replace('~\h*\[(?>[^][]++|(?R))*+]\h*~', ' ', $a);
You have javascript disabled. You will not be able to edit any code.