ereg/preg replace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maheswaran
    New Member
    • Mar 2007
    • 190

    ereg/preg replace

    Want to replace the field

    D:\\Program Files\\xampp\\h tdocs\\sample

    into

    D:\Program Files\xampp\htd ocs\sample

    I tryed lot using ereg/preg replace but not suceed.....

    help......
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    It is probably because you have not escaped the backslashes
    (and double backslashes)
    str_replace() should be ok for this task
    Code:
    $str = str_replace('\\','\',$str);

    Comment

    Working...