Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

`
(?|(\[[\"]?.+?[\"]?\])(=>)\R\s*|(?<=\(0\) )(\{)\R\s*(\}))
`
g

Description

The PHP function var_dump() provides debugging output, but has more line-breaks than is needed for readability. This regex strips out the (in my eyes) unnecessary line-breaks. Good in a self written debugging method in combination with ob_start()and ob_get_contents().

Submitted by Doqnach - 8 years ago