I'm having a hell of a time getting a nice regular expression to work with preg_split. I very clearly have no idea what I'm doing when it comes to regex's.
What I want to do is find quoted strings in a search box and then have any other strings become other array entries.
So the following string:
start test "test string 1" "test string 2" not a test
would become
ar[0]="start"
ar[1]="test"
ar[2]="test string 1"
ar[3]="test string 2"
ar[4]="not"
ar[5]="a"
ar[6]="test"
I've tried hundreds of things that didn't work, so I might as well not give what I've already tried, because it's not going to get us anywhere.
What I CAN say is that this expression, in expresso produces close to the right results: "["\r\n]"
It would show me anything in quotes. But it wouldn't bring back the extra. However, when I put /"["\r\n]"/ into preg_split, it absolutely doesn't work.
Any thoughts?