After reading the title, you are probably wondering what am i talking about. Heres an example:

local str = [[
local me = game:GetService("Players").LocalPlayer
local Mouse = me:GetMouse()
]]
--The word that i want to gsub is "me" but i don't want to do it manually, what i want to do is to get the word before ":GetMouse()" (which is "me") and then remove it.

How could i do this?