RE: [PHP] Regex Form Filter Help
| From: | Demitrious S. Kelly | Date: | Wed, 27 Mar 2002 20:56:13 +0000 |
| Subject: | RE: [PHP] Regex Form Filter Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90420@lists.php.net to get a copy of this message | ||
Why not just limit it to one <br>?
<?php
$string="blah<br><br><br><br><br><br><br><br><br>stuff";
while ( stristr($string, '<br><br>') ) {
$string=str_replace('<br><br>', '<br>', $string);
}
echo $string;
?>
something like that would wok well enough...
-----Original Message-----
From: James Taylor [mailto:jtx@nestllc.com]
Sent: Wednesday, March 27, 2002 12:26 PM
To: php-general@lists.php.net
Subject: [PHP] Regex Form Filter Help
I have a site where users can type whatever they want in and it posts it
to a
database. I'm trying to eliminate whatever types of abuse I can think
of,
and, since I'm using nl2br on the posts, I'm afraid a user might just
hold
down enter for a couple of seconds and scroll everything off the page.
I'm
trying to figure out a regex pattern that searches for say, more than 5
<br
/> strings in a row, and anything after 5 gets stripped out. Any ideas
on
how to possibly do this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php