<?php $re = '~(?:\[[^][]*]){2,}~'; $str = "[one][two][three]"; preg_match($re, $str, $matches);print_r($matches[0]);
Standard input is empty
[one][two][three]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!