string = "this is a test of of the emergency broadcast system. It is only a
test. If you expect this to go on and on, you are correct.";
cut=REReplace(string, '(.{1,24} )', '\1|','all');
</CFSCRIPT>
Your string is now cut up into a list. Each list element (delimited by a pipe)
is at most 25 characters long and ends in a space. Using a loop over the list
will allow you to put each slice into the DB.
Is this basically what you wanted?
> Thanks, but this isn't for display purposes, it's to break long strings into
> multiple sub strings witch will each be inserted into a database. I have to
> live with size limits on the fields, but you can have multiple fields per
> text. Go figure, but I have no control over database design, so I have to
> live with the limitation.
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> -----Original Message-----
> From: Ubqtous [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 01, 2003 10:15 AM
> To: CF-Talk
> Subject: Re: The Last Space.
>
>
> Ian,
>
> On 12/1/2003 at 13:02, you wrote:
>
> IS> Anybody know a trick (regex or otherwise) to find the position of
> IS> the last white space character before an arbitrary limit?
>
> IS> In the following example, I want the position of the last white
> IS> space before the 25th character.
>
> IS> "The quick brown fox jumped over a lazy dog."
>
> IS> So I would want the position of the white space after 'fox', which
> IS> is the 20th character. This is the last white space before the
> IS> 25th character with is the 'e' in 'jumped'. Allowing me to break
> IS> the string into:
>
> IS> "The quick brown fox " <!-- note: trailing white space is
> IS> included. --> "jumped over a lazy dog."
>
> Not the homemade solution you're looking for, but MX6.1's wrap()
> function supposedly does 'smart' wrapping automatically:
>
> http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funca119.htm
> <http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funca119.htm>
>
> ~ Ubqtous ~
> _____
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

