On the client side I have a javascript showing the characters usage as the user types in, while on the server side I modified the perl script so that it chops off all characters after the number 1500.
unfortunately, I was asked to do put the maximum allowance on words instead of characters; but counting the words in the string passed to the script and chopping all text coming after word n. 250 is more difficult than I thought. I googled to see if I could find some info on how to do this but had no success.
can somebody help please?
thanks in advance!
$in{'text_area'} =~ m/((\w+\W+(?=\w)){250})/;
The text needed (here - the first 250 words chunk) is in $1.
The text_area may contain new line characters. s quantifier may be added then may be (have not tested this.) Also you have to count that the number of words may be less than 250. In this case the prev.post code is more flexible.