I need to parse a string to find certain values.

This is the initial string "gid\_10\_sid\_1594177336",
I need the value of "gid" (10) and of "sid" (1594177336).

How I can do this inside a jquery script?