We do this all the time in textareas.  I am on the train going home at
present but will send the list some code when I get back online later.

We have several functions to do this stuff.




"This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: JediHomer <[EMAIL PROTECTED]>
To: RegEx <[email protected]>
Sent: Thu Apr 07 17:21:12 2005
Subject: Re: counting words in a textarea

Quick and dirty way of doing it could be to split(" ") the textarea
into an array and then get the length of the array ?


On Apr 7, 2005 5:13 PM, JRose <[EMAIL PROTECTED]> wrote:
> greetings list,
> 
> I need to count the words in a textarea and validate client side that it
> doesn't exceed a certain number.
> 
> We have been trying to use regular expressions to count the words.  Is
> there a way to count the words in a string and return the number of words
> to test against this value.  We would then trim out the extra words and
> send them back to the form.
> 
> We have it working using indexOf and only checking for spaces, but run
into
> problems when there are tabs in the textarea.
> 
> thanks and kind regards,
> Jeffrey
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:866
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to