# [Japt], 8 bytes r"%d*$"V [Try it online!][TIO-j3lagnsv] # Explanation r"%d*$"V Ur"%d*$"V # Implicit input (U) Ur # In the first input string, replace "%d*$" # 0 or more trailing digits V # By the second input # Implicit output [Japt]: https://github.com/ETHproductions/japt [TIO-j3lagnsv]: https://tio.run/##y0osKPn/v0hJNUVLRSns/3@lxKRkJR0FJRNTMyUA "Japt – Try It Online"