?
$str = "this is a star * and a backslash \, these are ( parentheses ) and this is NUL" & @crlf
$str &= _
"*, \2A" & @CRLF & _
"(, \28" & @CRLF & _
"), \29" & @CRLF & _
"\, \5C" & @CRLF & _
"NUL, \00"
$res = StringRegExpReplace(Execute('"' & StringRegExpReplace($str, '(\*|\(|\)|\\(?![[:xdigit:]]{2}))', '" & "\\" & hex(ascw("$1"),2) & "') & '"'), '(NUL)', "\\00")
Msgbox(0,"", $res)