Is there any way to search and replace certain strings, but also watch out for similar strings, and not replace those?

for example, if i have 

```
self.a
self.b
self.c
self.d
self.e
self.f
self.g

```

and i wanted

```
self.a
self.__b
self.c
self.__d
self.__e
self.f
self.g

```

and i want to add `__` to some of the variables to make them private, but not others, how would i do it, short of changing each individually, or changing all of them and then undoing the ones i dont want? my program has a large number of variables and uses each of them very often, so i dont want to go through the code myself.