#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "\$([\w]+)->([^\W]+)"
Local $sString = " @foreach($fsn_uploaded_data as $client_no => $client)" & @CRLF & _
" <div class="client" style="border: 1px solid #888; margin-bottom: 10px;">" & @CRLF & _
" <h2>{{ $client['client_name'] or '-' }}</h2>" & @CRLF & _
" <p>{{ $client->postal_address or '-' }}, {{ $client->zip_code_postcode or '-' }}, {{ $client->city or '-' }}, {{ $client->countr_code or '-' }}</p>" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"{{-- @foreach($client->delivery_addresses as $delivery_no => $address)" & @CRLF & _
" <div class="delivery_addresses" style="border: 1px solid #ddd; margin: 5px;">" & @CRLF & _
" <h3>{{ $address->client_delivery_name or '-' }}</h3>" & @CRLF & _
" <p>{{ $address->delivery_address or '-' }}, {{ $address->zip_code or '-' }}</p>" & @CRLF & _
" </div>" & @CRLF & _
" @endforeach --}}" & @CRLF & _
" </div>" & @CRLF & _
" @endforeach"
Local $sSubst = "$\1['\2']"
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