Search code examples
vimreplace

Vim Search/replace: what do I need to escape?


I'm trying to search and replace $data['user'] for $data['sessionUser'].

However, no matter what search string I use, I always get a "pattern not found" as the result of it.

So, what would be the correct search string? Do I need to escape any of these characters? :%s/$data['user']/$data['sessionUser']/g


Solution

  • :%s/\$data\[\'user\'\]/$data['sessionUser']/g
    

    I did not test this, but I guess it should work.