Remove all backslashes from a string - php - regex
php, regex, str-replace
Solution
I think you aren't looking for a regex, but for the `stripslashes($str)` method.
EDIT: From the comments, I understand that you will only replace `\"` with nothing, you should use a simple `str_replace` here, as @Gumbo said:
$str = ...;
$newStr = str_replace('\"', '', $str);
echo $newStr;
You can use regular expressions for this, but the pReg library isn't fast, if you can find a str_* or array variant which does the same I always recommend to use that instead of preg_*
Problem
my string is ``` $str = '<img src="\"images/hai.jpg\"" alt="" /> Text <img src="\"images/hai.jpg\"" alt="" />'; ``` i want to remove all \" from the string.