换行符,换行符和回车符的正则表达式

I want to replace "
,, " these characters & break tag from a string. I try to build following regular expression but failed.

$strText = preg_replace( '/[^|
]|<br\W*?\/>/', ' ', $strText );

For eg:-

$strtext = 'Test111<br>222<br/>333444
555';
Expected = 'Test111 222 333 444 555';

You can use the following solution:

$strText = 'Test111<br>222<br/>333444
555';
$strText = preg_replace('/(<br\/*>|\\|\\
)/', ' ', $strText);

var_dump($strText); //string(23) "Test111 222 333 444 555"

demo: https://ideone.com/xCqQsj

I would use an array

$strText = preg_replace( [
    "/[
]/",    //New Lines
    "/<br[^>]*>/", //Break tags
    "/\s{2,}/"     //Run-on spaces
  ], " ", $strText );

When you use an array the replacements are done in order, so we can put \s{2,} 2 or more spaces at the end to get any run-on spaces.