start = 1;
aLog = ArrayNew(1);
while(true){
stTmp =
REFind("[*]{3}([^*]*[[:space:]])([0-9]{1,2}/[0-9]{1,2}/[0-9]{4})[[:space
:]]+([0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2})([[:space:]][^*]*)[*]{3}",str,star
t,true);
if(stTmp.pos[1]){
stLog = StructNew();
stLog = StructNew();
user1 = Mid(str,stTmp.pos[2],stTmp.len[2]);
stLog.date = Mid(str,stTmp.pos[3],stTmp.len[3]);
stLog.time = Mid(str,stTmp.pos[4],stTmp.len[4]);
user2 = Mid(str,stTmp.pos[5],stTmp.len[5]);
if(len(trim(user1))) stLog.user = trim(user1);
else if(len(trim(user2))) stLog.user = trim(user2);
else stLog.user = "";
stLog.text = "";
if(ArrayLen(aLog)){
aLog[ArrayLen(aLog)].text =
Mid(str,start,stTmp.pos[1]-start);
}
ArrayAppend(aLog,stLog);
start = stTmp.pos[1]+stTmp.len[1];
}
else{
if(ArrayLen(aLog)){
aLog[ArrayLen(aLog)].text =
Trim(Mid(str,start,Len(str)-start));
}
break;
}
}
</cfscript>
<cfoutput>
<cfloop from="1" to="#ArrayLen(aLog)#" index="i">
<div class="timestamp">#aLog[i].user# #aLog[i].date#
#aLog[i].time#</div>
<pre>#aLog[i].text#</pre>
</cfloop>
</cfoutput>
> -----Original Message-----
> From: cf coder [mailto:[EMAIL PROTECTED]
> Sent: maandag 17 mei 2004 14:32
> To: CF-Talk
> Subject: Re: help with string manipulation (Find,Replace)
>
> Pascal, sorry again for being such a PEST. I really do
> apprecaite your help.
>
> There can be more than one occurance of the timestamp in the
> comment column. Ex:
>
> *** 05/12/2003 09:52:10 USER1 ***
> closing if fixed - awaitng response from User2
>
> *** 04/12/2003 18:55:18 USER2 ***
> Have been there, however user was on air shortly after, will
> try again in a bit.
>
> *** 04/12/2003 18:13:22 USER3 ***
> Roger that
>
> *** 04/12/2003 18:05:01 USER4 ***
> closed
>
> Can you please add code in your script to handle this and
> display all timestamps correctly
>
> Many thanks again
> cfcoder
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

