im trying to replace a remove unnessary new lines with preg-replace but my regex is incorrect. Anyone any ideas whats wrong with my regex? (i have Apache/2.0.54 & PHP/5.2.9
NOW HAVE:
{
blaa {
blow;
blue};
bell;}
}ball
WOULD LIKE:
{blaa {blow;blue};bell;}}ball
These regex dont work, they remove too much or toolitle??
$buffer = preg_replace('#/\}\n|\r|\s/#s', '}', $buffer);
$buffer = preg_replace('#/\{\n|\r|\s/#s', '{', $buffer);
$buffer = preg_replace('#/\;\n|\r|\s/#s', ';', $buffer);
/g (global) gives blanc content and without the # it doestnt do anything. strange?! Anybody any clue why these dont work?
\s
does already contain\r
and\n
. – Gumbo Dec 13 '10 at 17:08