I have this string in $s
:
ben say (#yellow) hey
At the moment I\'m using:
$parts = array_filter(preg_sp
Well you can try this replacement:
$s = str_replace(array('(', ')'), array('( ', ' )'), $s);
$parts = array_filter(preg_split('/\s+/', $s));
The trick here is to add a space between your (
and the word so that it gets splitted. However, it will only work specific to your example. Things like ((
might cause some unwanted results. If so you can try using preg_replace instead.