Wolfram Function Repository
Instantuse addon functions for the Wolfram Language
Function Repository Resource:
Similar to ReplaceAll, but parts of the expression can be ignored by providing a pattern
ResourceFunction["ReplaceAllOutside"][expr,rules,except] applies a rule or list of rules in an attempt to transform the entire expression expr while ignoring subexpressions contained in except. 

ResourceFunction["ReplaceAllOutside"][rules,except] represents an operator form of ResourceFunction["ReplaceAllOutside"] that can be applied to an expression. 

ResourceFunction["ReplaceAllOutside"][except] represents an operator form of ResourceFunction["ReplaceAllOutside"] that can be applied to arguments. 
Replace every instance of an expression, but ignore cases contained in a particular head:
In[1]:= 

Out[1]= 

In[2]:= 

Out[2]= 

Exact matches are also ignored:
In[3]:= 

Out[3]= 

Provide a list of replacement rules:
In[4]:= 

Out[4]= 

Provide nested lists of replacement rules:
In[5]:= 

Out[5]= 

Use a Dispatch for replacement rules:
In[6]:= 

Out[6]= 

In[7]:= 

Out[7]= 

Use an Association for replacement rules:
In[8]:= 

Out[8]= 

In[9]:= 

Out[9]= 

Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License