regex for multiple line breakes
| From: | Merlin Morgenstern | Date: | Wed, 14 Oct 2009 10:17:12 +0000 |
| Subject: | regex for multiple line breakes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298889@lists.php.net to get a copy of this message | ||
Hi there,
I am trying to remove multiple linebreakes from a textarea input. Spammers tend to insert multiple line breakes. The problem is, that I want to allow 2 line breaks so basic formating should be allowed.
I am doing this by regex:
$data[txt] = preg_replace('
[\r\n]+',"\n",$data[txt]);
I would need a regex that allows \r\n\r\n, but not more than this.
Thank you for any help,
Merlin