Page 1 of 1

How do you stop hundreds of the same chars without space?

Posted: Tue Aug 18, 2015 6:05 am
by simonmlewis
We have an area where people can post comments, but some enter hundreds and hundreds of !!!!! and it forces the admin page to go off the chart.

So can a script operate that stops words of more than x characters wthout spaces?

Re: How do you stop hundreds of the same chars without space

Posted: Tue Aug 18, 2015 7:20 am
by Celauran
overflow-wrap in CSS might suit your needs.

Re: How do you stop hundreds of the same chars without space

Posted: Tue Aug 18, 2015 7:38 am
by simonmlewis
Mmm it's mre about preventing it than wrapping it.
I want to stop someone posting that sort of spamming rubbish.

Re: How do you stop hundreds of the same chars without space

Posted: Tue Aug 18, 2015 8:06 am
by Celauran
simonmlewis wrote:So can a script operate that stops words of more than x characters wthout spaces?

Code: Select all

preg_match('/[^\s]{20}/', $string);
will match strings with more than 20 characters without a space, as an example.