Regex Help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jsmain
Posts: 62
Joined: 07 Feb 2014, 08:21

Regex Help

17 Jan 2018, 14:32

I'm trying to parse a operation summary for files that didn't convert.

I can't seem to get all the errors in my regex string.
In this example, I am only getting 15 of the 22 errors....
https://regex101.com/r/aH4gab/2

Can someone help me get the remaining errors in the text please?

I suspect it is in this part of the code...
\n+.*ERROR:
When removed, I get all 28 files, but I'm trying to get only those files that produced an error.

Thanks for your assistance!
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Regex Help

17 Jan 2018, 15:14

Code: Select all

arr := StrSplit(fileLOg,"`n"), errors := 0, fileFound := false
Loop, % arr.Length() {
   l := arr[a_index]
   if ( RegExMatch(l, "Processing file") ) {
      filnam := RegExReplace(l, ".*Processing file\s*\d+ of \d+,\s*(.*)\s*\.\.\.","$1") 
      fileFound := true
   }
   if ( RegExMatch(l, "ERROR:") && filefound ) {
      ++errors
      str .= errors "-" filnam "`t" l "`n"
      fileFound := false      
   }
}
msgbox % str
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
jsmain
Posts: 62
Joined: 07 Feb 2014, 08:21

Re: Regex Help

17 Jan 2018, 15:58

Thanks! That works too I guess. I was trying to do it all in one query.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 143 guests