#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?i)(\s*)(|"|')(name|phoneNumber|race|gender|birthdate|geodata)(|"|')(\s*)(:|=)(\s*)('|"|\s*)(\s*)(^$|.*?)(\s*)('|,|"|\))"
Local $sString = ""username":"username"" & @CRLF & _
""phonenumber":"123 456 7890"" & @CRLF & _
""race":"undisclosed"" & @CRLF & _
""gender":"female"" & @CRLF & _
""birthdate":"03/12/1889"" & @CRLF & _
""geodata":"123 456 7890"" & @CRLF & _
""phonenumber":"123 456 7890"" & @CRLF & _
""geodata":"38.897957""
Local $sSubst = "$1$2$3$4$5$6$7$8$9*******$11$12"
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