Had to write it to make sure regex worked lol ----- Original Message ----- From: "Jeff Beer" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, January 08, 2002 12:18 PM Subject: RE: RegExp help needed
> Holy cow, Don - I was hoping for some tips - you wrote the whole darn > thingy! > > I'll test it right away - thanks mucho for the assist!! > > Regards, > > Jeff > > -----Original Message----- > From: Don Vawter [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 08, 2002 1:29 PM > To: CF-Talk > Subject: Re: RegExp help needed > > > Try this: > <cffile action="READ" file="foo" variable="mf"> > <cfscript> > startpos=1; > stTime=refindnocase("DateTime\:[ ]*(\{[^\}]*\})",mf,startpos,"yes"); > while(startpos LT len(mf) and startpos GT 0 and stTime.pos[1] GT 0){ > if(arraylen(stTime.pos) GT 1) > timeval=mid(mf,stTime.pos[2],stTime.len[2]); > else timeval=""; > writeoutput(timeval & "---"); > startpos=stTime.pos[1]+stTime.len[1]; > if(startpos GT 0){ > > > > stId=refindnocase("Message_Id\:[ ]*([^<]*)<p",mf,startpos,"yes"); > if(arraylen(stId.pos) GT 1) > idval=mid(mf,stId.pos[2],stId.len[2]); > else idval=""; > writeoutput(idval &"<br>"); > startpos=stId.pos[1]+stId.len[1]; > } > if (startpos GT 0) > stTime=refindnocase("DateTime\:[ ]*(\{[^\}]*\})",mf,startpos,"yes"); > } > </cfscript> > > HTH > > ----- Original Message ----- > From: "Jeff Beer" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Tuesday, January 08, 2002 10:43 AM > Subject: RegExp help needed > > > > Hello all, > > > > I have a text file that's a save of a bunch of messages from Outlook. The > > messages are error reports from CF sent with CFMail. The formatting > sucks - > > I never expected to get a bunch - I was using it for debugging.. anyway, I > > have several hundred I need to parse. Silly transaction logs.... > > > > The layout is below. What I need to do is get the datetime string and the > > message ID from each instance of an error message in that file so I can > > update our database. > > > > ---- start 'record' ----- > > > > x:\inetpub\domain\subdir\errorfile.cfm<p> > > > > DateTime: {ts '2002-01-06 00:44:09'}<p> > > > > URL Message_ID: 23660 <p> > > > > > > Message: ODBC Error Code = 37000 (Syntax error or access > > violation)<P><p> > > Detail: [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for > > database 'dsdb' is full. Back up the transaction log for the database to > > free up some log space.<P><P> > > > > ---- end 'record' ----- > > > > The file has this format several hundred times over. > > > > Reading it in with cffile is simple. What I can't figure out is how to > > write the pattern matching code to extract the two variables. Also, the > > logic to make sure I have matching pairs is pretty easy - it's just the > > RegExps that are killing me. > > > > This is probably simple; I could write this in Perl but can't seem to do > it > > in CF. > > > > Thanks in advance, > > > > Jeff > > > > ______________________________________________________________________ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

