本帖最后由 fybhwsx 于 2020-4-3 19:49 编辑
用A版的Au3.REHelper_1.5.1,只会简单的单行提取一些东西,感谢A版的工具。。
我想要提取:
DeviceID : \\.\PHYSICALDRIVE2 这行末尾的(数字)
Model : INTEL SSDSA2M080G2GC 这行Model : (需要的字符)
SerialNumber : CVPO011303WM080BGN 这行 SerialNumber :(需要的字符)
……
整理格式:中间加两个空格
2 INTEL SSDSA2M080G2GC CVPO011303WM080BGN
……
### 友情提示:本脚本由 Au3.REHelper 于 2020/04/03 18:02 自动生成,不保证其正确性,请自行测试 ###
#include <Array.au3>
Local $sSource = _
@CRLF & _
'__GENUS : 2' & @CRLF & _
'__CLASS : Win32_DiskDrive' & @CRLF & _
'__SUPERCLASS :' & @CRLF & _
'__DYNASTY :' & @CRLF & _
'__RELPATH : Win32_DiskDrive.DeviceID="\\\\.\\PHYSICALDRIVE1"' & @CRLF & _
'__PROPERTY_COUNT : 3' & @CRLF & _
'__DERIVATION : {}' & @CRLF & _
'__SERVER :' & @CRLF & _
'__NAMESPACE :' & @CRLF & _
'__PATH :' & @CRLF & _
'DeviceID : \\.\PHYSICALDRIVE1' & @CRLF & _
'Model : INTEL SSDSA2CW080G3' & @CRLF & _
'SerialNumber : CVPR149606A0080BGN' & @CRLF & _
'PSComputerName :' & @CRLF & @CRLF & _
'__GENUS : 2' & @CRLF & _
'__CLASS : Win32_DiskDrive' & @CRLF & _
'__SUPERCLASS :' & @CRLF & _
'__DYNASTY :' & @CRLF & _
'__RELPATH : Win32_DiskDrive.DeviceID="\\\\.\\PHYSICALDRIVE0"' & @CRLF & _
'__PROPERTY_COUNT : 3' & @CRLF & _
'__DERIVATION : {}' & @CRLF & _
'__SERVER :' & @CRLF & _
'__NAMESPACE :' & @CRLF & _
'__PATH :' & @CRLF & _
'DeviceID : \\.\PHYSICALDRIVE0' & @CRLF & _
'Model : Romex RAMDISK SCSI Device' & @CRLF & _
'SerialNumber : SN-FANCYRD20082011' & @CRLF & _
'PSComputerName :' & @CRLF & @CRLF & _
'__GENUS : 2' & @CRLF & _
'__CLASS : Win32_DiskDrive' & @CRLF & _
'__SUPERCLASS :' & @CRLF & _
'__DYNASTY :' & @CRLF & _
'__RELPATH : Win32_DiskDrive.DeviceID="\\\\.\\PHYSICALDRIVE2"' & @CRLF & _
'__PROPERTY_COUNT : 3' & @CRLF & _
'__DERIVATION : {}' & @CRLF & _
'__SERVER :' & @CRLF & _
'__NAMESPACE :' & @CRLF & _
'__PATH :' & @CRLF & _
'DeviceID : \\.\PHYSICALDRIVE2' & @CRLF & _
'Model : INTEL SSDSA2M080G2GC' & @CRLF & _
'SerialNumber : CVPO011303WM080BGN' & @CRLF & _
'PSComputerName :'
;~MsgBox(0, '源字符串', $sSource)
Local $aSRE = StringRegExp($sSource, 'DeviceID .*(\d+)', 3)
If Not @Error Then MsgBox(0, '匹配数量: ' & UBound($aSRE), '其中[0]元素为: ' & $aSRE[0])
_ArrayDisplay($aSRE, UBound($aSRE))
|