String.gsub/function to get the enclosing bracket

I need a string.gsub pattern / function that grabs the encompassing bracket of the sigma function

e.g.

rS(Σ(1, 2, 3))

returns

Σ(1, 2, 3)

I already have a pattern that does this: Σ%((.*)%)
But for nested brackets it fails, returning:

1, 2 ,3)

It also needs to involve brackets inside the sigma function, like this:

rS(Σ(1, 2, sin(4)))

Gets converted into

Σ(1, 2, sin(4))

This can either be a string.gsub pattern or a function that takes the string and returns the converted one

Thanks