不知道是不是要"parameters"后面这些。
### 友情提示:本脚本由 Au3 正则测试工具 于 2017年05月25日17点02分23秒 自动生成,不保证其正确性,请自行修改测试 ###
#include <Array.AU3>
$string = _
'{' & @CRLF & _
' "case1":{' & @CRLF & _
' "name" : "PI_Memory_DDR4_DIMMMaximumMemory_L",' & @CRLF & _
' "category" : "Memory",' & @CRLF & _
' "path" : "python C:\\BKC\\BKC_Automation\\scripts\\bkc_case\\linux\\memory\\PI_Memory_DDR4_DIMMMaximumMemory_L.py",' & @CRLF & _
' "parameters" : "--platform=HAHA --memory_num=1 --memory_size=16",' & @CRLF & _
' "logpath" : "%LC_RESULT_PATH%\\PI_Memory_DDR4_DIMMMaximumMemory_L",' & @CRLF & _
' "critical" : "0",' & @CRLF & _
' "pinned" : "0",' & @CRLF & _
' "EXECUTION_FROM" : "network",' & @CRLF & _
' "timeout" : "8000"' & @CRLF & _
' },' & @CRLF & _
' "case2":{' & @CRLF & _
' "name" : "PI_Networking_FortPark_ConnectivityEnableDisable_L",' & @CRLF & _
' "category" : "Networking",' & @CRLF & _
' "path" : "python C:\\BKC\\BKC_Automation\\scripts\\bkc_case\\linux\\networking\\PI_Networking_FortPark_ConnectivityEnableDisable_L.py",' & @CRLF & _
' "parameters" : "--platform=HAHA --dhcpip=192.168.1.6 --cycle=5 --FortPark=\"10GbE SFP+\"",' & @CRLF & _
' "logpath" : "%LC_RESULT_PATH%\\PI_Networking_FortPark_ConnectivityEnableDisable_L",' & @CRLF & _
' "critical" : "0",' & @CRLF & _
' "pinned" : "0",' & @CRLF & _
' "EXECUTION_FROM" : "network",' & @CRLF & _
' "timeout" : "5400"' & @CRLF & _
' },' & @CRLF & _
' "case3":{' & @CRLF & _
' "name" : "PI_PCIe_PCIModelAvailability_L",' & @CRLF & _
' "category" : "PCIe",' & @CRLF & _
' "path" : "python C:\\BKC\\BKC_Automation\\scripts\\bkc_case\\linux\\pcie\\PI_PCIe_PCIModelAvailability_L.py",' & @CRLF & _
' "parameters" : "--platform=HAHA --pciDevice=\"display\" --searchStr=\"Display,Vendor 10D;NVIDIA Corporation GT218\" --LinkStatus=\"2.5 GT/s,x8;2.5GT/s,x8\" --LinkCapabilities=\"2.5 GT/s,x16;2.5GT/s,x16\"",' & @CRLF & _
' "logpath" : "%LC_RESULT_PATH%\\PI_PCIe_PCIModelAvailability_L",' & @CRLF & _
' "critical" : "0",' & @CRLF & _
' "pinned" : "0",' & @CRLF & _
' "EXECUTION_FROM" : "network",' & @CRLF & _
' "timeout" : "5400"' & @CRLF & _
' }' & @CRLF & _
'}'
Local $Array = StringRegExp($string, '"parameters" : "(.*?),' ,3)
For $i = 0 To UBound($Array) - 1
NEXT
;以下为测试结果:
If Not @Error Then MsgBox(0, '匹配数量: ' & UBound($array), '其中$array[0]数组为: ' & $array[0])
_ArrayDisplay($Array, UBound($Array))
|