// replaces whitespace and date/time before first comment
str = REReplace(str,"^\s*([*]{3}.*?[*]{3})?\s*","");
// Replaces everything starting from next ***
str = REReplace(str,"^(.*?)\s*[*]{3}.*$","\1");
NOT tested, I don't have CFMX running at the moment
Pascal
> -----Original Message-----
> From: cf coder [mailto:[EMAIL PROTECTED]
> Sent: maandag 29 maart 2004 13:57
> To: CF-Talk
> Subject: Re: help with string manipulation (Find,Replace)
>
> Many Thanks Yalta for your help. Your code is good but there
> it does handle the comments column properly if the comments
> column has the following data:
>
>
>
> *** 09/05/2002 18:46:21 ***
> Closing as no point to this log
> Hot Swap
> *** 17/04/2002 13:08:15 ***
> OK can ayone tell me where the Request for the replacement PC is.
>
>
> I want to display the string "Closing as no point to this log
> Hot Swap" whereas if I use your code, the string that's displayed is:
> " 09/05/2002 18:46:21 "
>
> This is my code:
>
> <cfif Find('#Chr(13)#',qResults.Slug)>
> <cfset
> tmp=REReplaceNoCase(qResults.Slug,'^[^a-z0-9_]*([a-z0-9_])','\1')>
> <cfif Find('***',tmp) and trim(Left(tmp,Find('***',tmp)-1)) neq "">
> #trim(Left(tmp,Find('***',tmp)-1))#
> <cfelseif trim(Left(tmp,Find('#Chr(13)#',tmp))) neq "">
> #trim(Left(tmp,Find('#Chr(13)#',tmp)))#
> <cfelse>
> #tmp#
> </cfif>
> </cfif>
>
>
>
> > OK, just do something like
> > <cfset sTmp=REReplaceNoCase(qResults.Slug,'^[^a-z0-9_]*([a-z0-9_])',
> > '\1'>
> > to get rid of all leading characters you do not want, and then use
> > sTmp for you Find.
> >
> > Just a few remarks:
> > '^[^a-z0-9_]*([a-z0-9_])' means
> > First ^- Start at the start of the string only
> > [] one of those inside, with the second ^ - one of those NOT inside
> > * - repeated 0 to x times
> > () take everything inside and remember it - for a back reference \1
> > later
> > The () has to be used to make sure that all leading whitespace is
> > removed (ad consequently, you need a back reference later)
>
> >
> > You might want to experiment using a different collection of
> > excluded/included chars. There is for example \s for whitespace, \S
> > for non-whitespace, but my experiments with those CF-specific
> > character class definitions were never too lucky, so I prefer
> > enumerating the characters I want/don't want.
> >
> Yalta
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

