#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?:\s+)?(\w+)\?.\s+\w+(?:\[\])?"
Local $sString = "attributiAggiuntiviList?: List;" & @CRLF & _
" tipologiaAnagrafica?: number;" & @CRLF & _
" email?: string;" & @CRLF & _
" pec?: string;" & @CRLF & _
" sitoWeb?: string;" & @CRLF & _
" modalitaAcquisizione?: number;" & @CRLF & _
" dataAcquisizione?: Date;" & @CRLF & _
" referral?: string;" & @CRLF & _
" telefonos?: Telefon[];" & @CRLF & _
" preferenzaComunicazioneList?: List;" & @CRLF & _
" id?: string;" & @CRLF & _
" indirizzos?: Indirizzo[];" & @CRLF & _
" privacy?: Privacy[];" & @CRLF & _
" personaFisica?: PersonaFisica;" & @CRLF & _
" personaGiuridica?: string;" & @CRLF & _
" ente?: string;" & @CRLF & _
" uo?: string;" & @CRLF & _
" datiCliente?: DatiCliente;" & @CRLF & _
" datiFornitore?: DatiDipendente;" & @CRLF & _
" datiVendor?: DatiDipendente;" & @CRLF & _
" datiVettore?: DatiDipendente;" & @CRLF & _
" datiReferente?: DatiDipendente;" & @CRLF & _
" datiDipendente?: DatiDipendente;"
Local $sSubst = "this.$1 = item && "$1" in item ? item.$1 || null : null\n"
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