Re: RegExp help needed
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: > > > 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\:[ ]*([^<]*) if(arraylen(stId.pos) GT 1) > idval=mid(mf,stId.pos[2],stId.len[2]); > else idval=""; > writeoutput(idval &""); > startpos=stId.pos[1]+stId.len[1]; > } > if (startpos GT 0) > stTime=refindnocase("DateTime\:[ ]*(\{[^\}]*\})",mf,startpos,"yes"); > } > > > 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 > > > > DateTime: {ts '2002-01-06 00:44:09'} > > > > URL Message_ID: 23660 > > > > > > Message: ODBC Error Code = 37000 (Syntax error or access > > violation) > > 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. > > > > 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/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: RegExp help needed
Don't forget to cflock the call to cffile! :) Sam - Original Message - From: "Jeff Beer" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, January 08, 2002 2: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: > > > 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\:[ ]*([^<]*) if(arraylen(stId.pos) GT 1) > idval=mid(mf,stId.pos[2],stId.len[2]); > else idval=""; > writeoutput(idval &""); > startpos=stId.pos[1]+stId.len[1]; > } > if (startpos GT 0) > stTime=refindnocase("DateTime\:[ ]*(\{[^\}]*\})",mf,startpos,"yes"); > } > > > 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 > > > > DateTime: {ts '2002-01-06 00:44:09'} > > > > URL Message_ID: 23660 > > > > > > Message: ODBC Error Code = 37000 (Syntax error or access > > violation) > > 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. > > > > 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 > > > > __ Why Share? Dedicated Win 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=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
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: 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\:[ ]*([^<]*)"); startpos=stId.pos[1]+stId.len[1]; } if (startpos GT 0) stTime=refindnocase("DateTime\:[ ]*(\{[^\}]*\})",mf,startpos,"yes"); } 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 > > DateTime: {ts '2002-01-06 00:44:09'} > > URL Message_ID: 23660 > > > Message: ODBC Error Code = 37000 (Syntax error or access > violation) > 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. > > 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 > __ Why Share? Dedicated Win 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=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: RegExp help needed
Try this: 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\:[ ]*([^<]*)"); startpos=stId.pos[1]+stId.len[1]; } if (startpos GT 0) stTime=refindnocase("DateTime\:[ ]*(\{[^\}]*\})",mf,startpos,"yes"); } 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 > > DateTime: {ts '2002-01-06 00:44:09'} > > URL Message_ID: 23660 > > > Message: ODBC Error Code = 37000 (Syntax error or access > violation) > 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. > > 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/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
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 DateTime: {ts '2002-01-06 00:44:09'} URL Message_ID: 23660 Message: ODBC Error Code = 37000 (Syntax error or access violation) 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. 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 __ Why Share? Dedicated Win 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=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists