Newbie Wolfram Language Question

Hello.
I’m having a little difficulty understanding the behavior of the Characters function when I apply a set of rules to it. Let me explain.
I can apply it like I have below to create lists of the constituent characters in a string in two different ways producing the same output as shown below.

In[1]:= a=Characters[“fish”]
b=“fish” // Characters
Out[1]= {“f”, “i”, “s”, “h”}
Out[2]= {“f”, “i”, “s”, “h”}

Both ways of applying the function give the same output.

In[3]:= a==b
Out[3]= True

However, when I apply a rule to both expressions above, only one takes the change.

In[4]:= Characters[“fish”]/. {“f” → “d”}
“fish” // Characters/. {“f” → “d”}
Out[4]= {“d”, “i”, “s”, “h”}
Out[5]= {“f”, “i”, “s”, “h”}

If I apply the same rule to the variables set at the top, the rule is applied in both cases.

In[6]:= a/. {“f” → “d”}
b/. {“f” → “d”}
Out[6]= {“d”, “i”, “s”, “h”}
Out[7]= {“d”, “i”, “s”, “h”}

My question is shouldn’t “fish”//Characters/.{“f”->“d”} produce {d,i,s,h}? And if not, what is it that I am missing or not getting?

I have attached this post as a notebook as well.

Thanks.
Philip.

Wolfram Community Post 2019-07-02.nb (7.96 KB)

If you put parentheses to stipulate the order of operations this works.

("fish" // Characters) /. {"f" -> "d"}

(* {“d”, “i”, “s”, “h”} *)

Hi Philip,

As Claudio mentioned, you need to use parenthesis to override the default precedence. /. has a higher precedence than //. The precedence of all operators is documented here.

Thank you to both of you for your prompt answers.

The nuts and bolts:

In[1]:= Precedence[Postfix]
Out[1]= 70.

In[2]:= Precedence[ReplaceAll]
Out[2]= 110.