I have a regex expression which removes any backslashes from a string if not followed by one of these characters: \ / or }.

It should turn this string: 

```
foo\bar\\batz\/hi

```

Into this:

```
foobar\\batz\/hi

```

But the problem is that it is dealing with each backslash as it goes along. So it follows the rule in that it removes that first backslash, and ignores the 2nd one because it is followed by another backslash. But when it gets to the 3rd one, it removes it, because it isn't followed by another.

My current code looks like this: `str.replace(/\\(?!\\|\/|\})/g,"")`

But the resulting string looks like this: `foobar\batz\/hi`

How do I get it to skip the 3rd backslash? Or is it a case of doing some sort of explicit negative search & replace type thing? Eg. replace '\', but don't replace '\\', '\/' or '\}'?

Please help! :)

***EDIT***

Sorry, I should have explained - I am using javascript, so I don't think I can do negative lookbehinds...