Replacement Help, Patterns, Rules?

I have been trying to replace multiples of one thing in an expression, for example:

(E^(4 s - 2 z) + E^(8 s - 4 z) + E^(12 s - 6 z)) //. {(4 s - 2 z) -> meow}

However, I end up with the output of E^meow + E^(12 s - 6 z) + E^(8 s - 4 z), where as I would like it to be E^meow + E^(2 meow) + E^(3 meow) instead.

Also I would like to replace the following (g_1 + g_2 + g_3 + g_4) /. {g_1 -> h1, g_2 -> h2}. However, I would like it be a pattern for so it replaces all g_# to h# instead.

Note: by g_# I mean a subscript #

Any help would be greatly appreciated. I am sorry I cannot really give much more info, as I dont really know much about mathematica.

ClearAll[s, z]
FullSimplify[E^(4 s - 2 z) + E^(8 s - 4 z) + E^(12 s - 6 z),  w == 4 s - 2 z] /. w -> meow


E^meow (1 + E^meow + E^(2 meow))

ExpandAll @ %


E^meow + E^(2 meow) + E^(3 meow)

For the second part of the question:

expr = Plus @@ Array[Subscript[g, #] &, 4]


Subscript[g, 1] + Subscript[g, 2] + Subscript[g, 3] + Subscript[g, 4]

TeXForm @ expr


$$g_1+g_2+g_3+g_4$$

expr /. Subscript[a_, b_] :> Symbol["h" <> ToString[b]]


h1 + h2 + h3 + h4

• Thank you very much!! I greatly appreciate it!!!! Aug 16, 2019 at 0:58
• @CabbageLord, you are welcome. Thank you for the accept. And welcome to mma.se.
– kglr
Aug 16, 2019 at 1:09