#include <Array.au3>
Local $Str1 = _
'Disk Partitions Cylinders Heads Sectors Mbytes Model' & @CRLF & _
' 1 4 60801 255 63 476940.0 ST3500418AS' & @CRLF & _
' 2 5 60801 255 63 476940.0 ST9500325AS' & @CRLF & _
' 3 7 60801 255 63 476940.0 ST950032 5AS 0001' & @CRLF & _
' 4 1 1906 255 63 14952.0 CQUTOOLS DL07' & @CRLF & @CRLF
Local $Str2 = _
'Disk Partitions Cylinders Heads Sectors Mbytes Model' & @CRLF & _
' 1 4 60801 255 63 476940.0 ST3500418AS' & @CRLF & _
' 2 5 60801 255 63 476940.0 ST9500325AS' & @CRLF & _
' 3 7 60801 255 63 476940.0 ST950032 5AS 0001' & @CRLF & _
' 4 1 1906 255 63 14952.0 ADATA USB Flash' & @CRLF & @CRLF
Local $Str3 = _
'Disk Partitions Cylinders Heads Sectors Mbytes Model' & @CRLF & _
' 1 4 60801 255 63 476940.0 ST3500418AS' & @CRLF & _
' 2 5 60801 255 63 476940.0 ST9500325AS' & @CRLF & _
' 3 7 60801 255 63 476940.0 ST950032 5AS 0001' & @CRLF & _
' 4 1 1906 255 63 14952.0 Kingston DT102'
Local $Str = $Str1
;Local $Str = $Str2
;Local $Str = $Str3
MsgBox(0, '原字符串', $Str)
Local $str_Re = StringRegExpReplace($str, '.*(?:CQUTOOLS|Flash|Kingston).*\n?', '')
MsgBox(0, '替换结果', $str_Re)
Local $aSR = StringRegExp($str_Re, '\h+(\d)\h+(\d)(?:\h+\d+){3}\h+([\d.]+)\h+(\V+)', 3)
_ArrayDisplay($aSR, UBound($aSR))
|