Using a portion of an instance name

I am trying to use a MC instance name inside of a function from an event listener. How the hell do I use only part of the instance name

example:

MC instance names are “size1”, “size2”, etc.

I want the numbers only.

I have been looking for hours. Thanks in advance.