<?php $re = '/^(\S+)\h+\[\S*\](?!\S).*$(?![\s\S]*^\1)/m'; $str = 'green [foo] [foo1] red [foo] blue [foo] [foo1] [foo2] yellow [foo2] green [foo] green [foo] [foo1] red [foo] pink [foo3]'; preg_match_all($re, $str, $matches); print_r($matches[0]);
You have javascript disabled. You will not be able to edit any code.