I need to output the strings between []. For example I need this-echo, nobody to be displayed. But I am get this as result: [this-echo] Hello Everybody [nobody].
$txt = 'Hello World [this-echo] Hello Everybody [nobody]';
$regExp = '/\[([^)]+)\]/';
$match = preg_match("/\[(.*)\]/s", $txt, $output);