#include <Array.au3>
#Include <Date.au3>
Local $Str = _
'2015/05/23 10:19:22 Service Control Manager 0 7036 admin DHCP Client 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 10:19:22 Service Control Manager 0 7036 admin Windows Event Log 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 10:19:23 Service Control Manager 0 7036 admin Windows Font Cache Service 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 11:09:23 Service Control Manager 0 7036 admin Diagnostic Service Host 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 11:09:23 Service Control Manager 0 7036 admin Diagnostic Policy Service 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 11:15:23 Service Control Manager 0 7036 admin Function Discovery Resource Publication 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 11:19:23 Service Control Manager 0 7036 admin Cryptographic Services 服务处于 停止 状态。' & @CRLF & _
'2015/05/24 11:19:25 Service Control Manager 0 7036 admin KSafe service 服务处于 停止 状态。'
;~MsgBox(0, '原字符串', $Str)
Local $Now = '2015/05/24 11:20:25' ;_Now()
Local $nTime = 30
Local $aSR = StringRegExp($str, '(?m)^(([\d/]+\h+[\d:]+)\V+)', 3)
If @Error Then Exit
Local $i, $sOk = ''
For $i = 1 To UBound($aSR) - 2 Step 2
If _DateDiff('n', $aSR[$i], $Now) < $nTime Then $sOk &= $aSR[$i - 1] & @CRLF
Next
msgbox(0, '小于时间 ' & $Now & ' (' & $nTime & '分钟) 的行', $sOk)
|