Hello, I want my preg_replace change all (multiple) spaces into one charachter | , EXCEPT those spaces that are inside quotes, but I can't find the right expression.
testA testB testC testD --> testA|testB|testC|testD
testA "testB testC" testD --> testA|"testB testC"|testD
testA "testB testC testD" --> testA|"testB testC testD"
"testA testB testC" testD --> "testA testB testC"|testD
If possible also with the quotes gone, but I can do that with placing the quote in a second item of 2 arrays in preg_replace.
What I found so far is the following, but it's no good:
preg_replace ( array('/(?<![" ])\b(\s+)\b/','/\\\"/'), array('|','')
Help, I need somebody. Help, not just anybody. He-e-elp. (Referring to the song ;-) )