What's the cross-platform regex to replace a line ending?
php, regex
Solution
Try the regular expression `(?:\r\n|[\r\n])`:
preg_replace('/(?:\r\n|[\r\n])/', ', ', $str)
Problem
I've got a string like `"foo\nbar"`, but depending on platform, that could become `"foo\n\rbar"`, or whatever. I want to replace new lines with `", "`. Is there a nice (php) regex that'll do that for me?