How to replace different newline styles in PHP the smartest way?

$string = preg_replace(‘~\R~u’, “\r\n”, $string); If you don’t want to replace all Unicode newlines but only CRLF style ones, use: $string = preg_replace(‘~(*BSR_ANYCRLF)\R~’, “\r\n”, $string); \R matches these newlines, u is a modifier to treat the input string as UTF-8. From the PCRE docs: What \R matches By default, the sequence \R in a pattern … Read more

Not all properties displayed

I had the same experience once and created the following reusable ‘Union‘ function: # 2021-08-25 Removed Union function Usage: $Obj1, $Obj2 | Union | Out-GridView -Title ‘Showing all members’ It is also supposed to work with complex objects. Some standard cmdlets output multiple object types at once and if you view them (e.g. Out-GridView) or … Read more