I'm trying to implement a system similar to gmail search operators using function preg_match from PHP to split the input string . Example:
input string => command1:word1 word2 command2:word3 command3:word4 wordN
output array => (
command1:word1 word2,
command2:word3,
command3:word4 wordN
)
The following post explains how to do it: Implementing Google search operators
I already test it using preg_match but doesn't match. I think regular expressions may change a bit from system to system.
Any guess how regex in PHP would match this problem?
preg_match('/\s+(?=\w+:)/i','command1:word1 word2 command2:word3 command3:word4 wordN',$test);
Thanks,