// CKEditor adds

...many spaces, tabs and others [quote=...]

at the beginning, and this

breaks quote // As a solution, replace that combination with [quote=...] before continuing to usual Quote code // http://de.php.net/manual/en/function.preg-replace.php // The same about end: replace

...many spaces [/quote]

with just [/quote] $text = preg_replace('#

[\s\n\r\t]*(\[/?quote.*?])\s*

#is', '${1}', $text);