Loop, Parse, contents,`n { If A_LoopField contains %var1%%var2%
Thanks!
Loop, Parse, contents,`n { If A_LoopField contains %var1%%var2%
Loop, Parse, contents,`n { If A_LoopField contains %var1% If A_LoopField contains %var2% ; OK!
SetBatchLines, -1 Process, Priority, , R FileRead lines, E:\Tests\testimport140c-sp2\tools_testimport_Bif\TestSetAlarm\log\Proptima.200609151137.log timing = t1 := A_TickCount Loop 100 Loop Parse, lines, `n, `r { If A_LoopField contains java If A_LoopField contains Exception r = %r%%A_LoopField%`n } t2 := A_TickCount timing := timing . "contains: " . (t2 - t1) / 1000 . " seconds`n" r = t1 := A_TickCount Loop 100 Loop Parse, lines, `n, `r { If InStr(A_LoopField, "java") and InStr(A_LoopField, "Exception") r = %r%%A_LoopField%`n } t2 := A_TickCount timing := timing . "InStr: " . (t2 - t1) / 1000 . " seconds`n" r = t1 := A_TickCount Loop 100 Loop Parse, lines, `n, `r { If (RegExMatch(A_LoopField, "java.*Exception") > 0) r = %r%%A_LoopField%`n } t2 := A_TickCount timing := timing . "RegExMatch 1: " . (t2 - t1) / 1000 . " seconds`n" r = t1 := A_TickCount Loop 100 Loop Parse, lines, `n, `r { If (RegExMatch(A_LoopField, "java.*Exception|Exception.*java") > 0) r = %r%%A_LoopField%`n } t2 := A_TickCount timing := timing . "RegExMatch 2: " . (t2 - t1) / 1000 . " seconds`n" r = t1 := A_TickCount Loop 100 Loop Parse, lines, `n, `r { If (RegExMatch(A_LoopField, "Exception.*java|java.*Exception") > 0) r = %r%%A_LoopField%`n } t2 := A_TickCount timing := timing . "RegExMatch 3: " . (t2 - t1) / 1000 . " seconds`n" r = t1 := A_TickCount Loop 100 Loop Parse, lines, `n, `r { If (RegExMatch(A_LoopField, "java.*Exception") > 0 || RegExMatch(A_LoopField, "Exception.*java") > 0) r = %r%%A_LoopField%`n } t2 := A_TickCount timing := timing . "RegExMatch 4: " . (t2 - t1) / 1000 . " seconds`n" MsgBox %timing%Note that in my case, RegExMatch 1 is incorrect, as it doesn't report some lines. But it is efficient if you are sure of the order of the strings. In all cases, InStr is the fastest, which is rather logical.