There are numerous ways to achieve what you want. For the substitution itself, the only thing that might be slightly beyond a pure beginner's knowledge, the first idea that comes to mind is to use the substitution operator,
. You'll find detailed documentation on this in this chapter
document. Look in particular at the