Jump to content

Help For Preg_Replace


shamuraq

Recommended Posts

Hi guys,

 

am not very good with regex. I need to replace all double backslashes '\\' in my string into single backslashes '\'. I tried:

 

 

$pattern = '[\\]';
$replacement = '/\/';

?>
       <td width="100%"> <?php echo preg_replace($pattern, $replacement,$q[$i]);?></td>

 

i also tried a few other combinations but the output is either blank or more backslashes are added. Any pointers are appreciated.

Thanx in advance.

Link to comment
https://forums.phpfreaks.com/topic/269696-help-for-preg_replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.