2 Formatted code

I have:

In := f[a, b] /. f[x__] -> g[x, 0] // InputForm
Out(* =Out: g[a, b, 0] *)


Which is what I expect, but when I use a built in symbol instead of f, the result is different, for example:

In := Times[a, b] /. Times[x__] -> g[x, 0] // InputForm
Out(* =Out: g[a*b, 0] *)


How could I replace the multiplication in this case to get the same result as above?

I have:

In := f[a, b] /. f[x__] -> g[x, 0] // InputForm
Out = g[a, b, 0]


Which is what I expect, but when I use a built in symbol instead of f, the result is different, for example:

In := Times[a, b] /. Times[x__] -> g[x, 0] // InputForm
Out = g[a*b, 0]


How could I replace the multiplication in this case to get the same result as above?

I have:

f[a, b] /. f[x__] -> g[x, 0] // InputForm
(* Out: g[a, b, 0] *)


Which is what I expect, but when I use a built in symbol instead of f, the result is different, for example:

Times[a, b] /. Times[x__] -> g[x, 0] // InputForm
(* Out: g[a*b, 0] *)


How could I replace the multiplication in this case to get the same result as above?

1

# Replacing with pattern on built-in symbols?

I have:

In := f[a, b] /. f[x__] -> g[x, 0] // InputForm
Out = g[a, b, 0]


Which is what I expect, but when I use a built in symbol instead of f, the result is different, for example:

In := Times[a, b] /. Times[x__] -> g[x, 0] // InputForm
Out = g[a*b, 0]


How could I replace the multiplication in this case to get the same result as above?