Q:

String function: preg-replace

I have not achieved result as expected.  Here is what my string and code look like in PHP.
$string in text box 
"This is 《Carriage Return》
a 《Carriage Return》
test"

Then using code in PHP:
$cleanstring=preg_replace('/\s+/', ' ', $string); //(' ' has a space in between)

Result came out as:
$cleanstring="This is\r\na\r\ntest"

But I expected it to be as "This is a test"

A:

found the code that works:
$cleanstring=trim(preg_replace('/\s{1,}/', ' ', $string));

