#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "dcs.lustre.device.ost.attributes\[.*-((.*).+?),.*,rate\]"
Local $sString = "[" & @CRLF & _
"{" & @CRLF & _
"itemid: "26940"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "60843699081216"," & @CRLF & _
"lastclock: "1454321651"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0000,kbytesavail]"," & @CRLF & _
"name: "OST0000 available space"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "60"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26943"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "61486384615424"," & @CRLF & _
"lastclock: "1454321686"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0001,kbytesfree]"," & @CRLF & _
"name: "OST0001 free space"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "5"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26944"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "62068190941184"," & @CRLF & _
"lastclock: "1454272094"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0000,kbytestotal]"," & @CRLF & _
"name: "OST0000 total space"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "86400"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26945"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "62068190941184"," & @CRLF & _
"lastclock: "1454272092"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0001,kbytestotal]"," & @CRLF & _
"name: "OST0001 total space"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "86400"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26946"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "0"," & @CRLF & _
"lastclock: "1454321686"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0000,read_bytes,rate]"," & @CRLF & _
"name: "OST0000 read"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "5"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes/sec"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26942"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "61477895307264"," & @CRLF & _
"lastclock: "1454321686"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0000,kbytesfree]"," & @CRLF & _
"name: "OST0000 free space"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "5"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26951"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "2878341087"," & @CRLF & _
"lastclock: "1454321686"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0001,write_bytes,rate]"," & @CRLF & _
"name: "OST0001 write"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "5"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes/sec"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26950"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "3185573852"," & @CRLF & _
"lastclock: "1454321686"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0000,write_bytes,rate]"," & @CRLF & _
"name: "OST0000 write"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "5"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes/sec"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
"itemid: "26947"," & @CRLF & _
"status: "0"," & @CRLF & _
"lastvalue: "0"," & @CRLF & _
"lastclock: "1454321686"," & @CRLF & _
"key_: "dcs.lustre.device.ost.attributes[plexfs-OST0001,read_bytes,rate]"," & @CRLF & _
"name: "OST0001 read"," & @CRLF & _
"hostname: "lustre_plexfs"," & @CRLF & _
"value: "lustre"," & @CRLF & _
"delay: "5"," & @CRLF & _
"value_type: "3"," & @CRLF & _
"units: "Bytes/sec"," & @CRLF & _
"category: "performance"," & @CRLF & _
"type: "filesystem"," & @CRLF & _
"history: "90"" & @CRLF & _
"}" & @CRLF & _
"]"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm