本帖最后由 afan 于 2020-9-17 15:00 编辑 #include <Date.au3>
Local $sSource = _
'CSName HotFixID InstalledOn ' & @CRLF & _
'COMPUTER01 KB4346084 9/12/2020 ' & @CRLF & _
'COMPUTER01 KB4456655 11/16/2019 ' & @CRLF & _
'COMPUTER01 KB4512576 7/16/2020 ' & @CRLF & _
'COMPUTER01 KB4516058 11/18/2019 '
;~ MsgBox(0, '源字符串', $sSource)
Local $aSRE = StringRegExp($sSource, "(?m)^(.+\h+(\d+)/(\d+)/(\d+))\h*$", 3)
If @Error Then Exit MsgBox(48, '', '数据不符')
Local $sOut = '', $vtmp
For $ii = 0 To UBound($aSRE) - 1 Step 4
$vtmp = StringFormat('%04d/%02d/%02d', $aSRE[$ii + 3], $aSRE[$ii + 1], $aSRE[$ii + 2])
If _DateDiff('M', $vtmp, _NowCalc()) <= 3 Then
$sOut &= $aSRE[$ii] & @CRLF
EndIf
Next
MsgBox(0, '', $sOut)
|