First, like many other people, regular expressions may be too heavy for a tool to work with, but the solution you use should work.
$newstr = preg_replace('/\\\\/', '\\', $mystr);
, , preg_replace , , .
str_replace :
$newstr = str_replace('\\\\', '\\', $mystr);
, , .