#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\{\s*"timestamp"\s*:\s*(\d+),\s*"value"\s*:\s*"[\d\.,]+,88\/TCP"\s*\}"
Local $sString = "{"host":{"ip":"192.168.82.100","mac":"00e04c684221","fields":{"session":[{"timestamp":1610875789,"value":"192.168.82.100,192.168.81.30,44/TCP"},{"timestamp":1610875775,"value":"192.168.82.100,192.168.81.20,88/TCP"}]}" & @CRLF & _
"" & @CRLF & _
"{" & @CRLF & _
" "host": {" & @CRLF & _
" "ip": "192.168.82.100"," & @CRLF & _
" "mac": "00e04c684221"," & @CRLF & _
" "fields": {" & @CRLF & _
" "session": [" & @CRLF & _
" {" & @CRLF & _
" "timestamp": 1610875789," & @CRLF & _
" "value": "192.168.82.100,192.168.81.30,44/TCP"" & @CRLF & _
" }," & @CRLF & _
" {" & @CRLF & _
" "timestamp": 1610875775," & @CRLF & _
" "value": "192.168.82.100,192.168.81.20,88/TCP"" & @CRLF & _
" }" & @CRLF & _
" ]" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
"}"
Local $sSubst = "$1"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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