Reputation: 190
Is it possible to take this:
a=[[do end workspace.Part["Child 1"].Object.child2["thing"]remove() do end]]
a=a:gsub("%.%a+","{F}%0{F}")
a=a:gsub('(%[%s*([\'"]?).*%2%s*%]):remove%(%)','{F}%1{F}:remove()')
a=a:gsub('{F}%s*{F}','')
a=a:gsub('{F}.-{F}','filterremove(%0)')
Output: do end filterremove(Workspace.Part["Child 1"].Object.child2["thing"]) do end
and use only one gsub to have the same result, rather than two? regardless of the combination of x.y, x[y], [x][y], etc.
Upvotes: 3
Views: 192
Reputation: 97691
You can at least chain and line-wrap it:
a = [[do end workspace.Part["Child 1"]:remove() do end]]
a = a:gsub("%.%a+","{F}%0{F}")
:gsub('(%[%s*([\'"]?).*%2%s*%]):remove%(%)','{F}%1{F}:remove()')
:gsub('{F}%s*{F}','')
:gsub('{F}.-{F}','filterremove(%0)')
Really though, this is never going to work. What about:
workspace.remove(x)
workspace["remove"](x)
getfenv()["work" .. "space"]["re".."move"](x)
Upvotes: 1