strip out too many newlines
| From: | Sebastian | Date: | Thu, 04 Aug 2005 13:44:10 +0000 |
| Subject: | strip out too many newlines | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-220001@lists.php.net to get a copy of this message | ||
im working on a comment/forum app and when a user enters too many carriage returns i want to remove them before insert to db.
example, user input:
-----snip-----
[quote=user]
foo
[/quote]
<bunch of extra lines>
more text...
-----snip-----
I to change to:
[quote=user]foo[/quote]
more text...
i try this regexp:
$message = preg_replace('#(\[quote(=("|"|\'|)([^\]]*)\\3)?\])\s+#i', "\\1\n", $_POST['message']);
doesn't remove / replace anything.
I need for it to work when they use [quote=xx] or [quote] and ends with [/quote]
any help?
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005