Converting a compact vector2 string into a table format

I want to separate this string: X3Y6 into its X and Y counterparts. For example:

X6Y0 = {6,0}

I’m really terrible with the wacky string stuff, so any help is appreciated.

Edit for clarification: the strings can go upwards to double digits, so just getting the 2nd and 4th character won’t work with what i’m doing.

local str = "X3Y6"
local x, y = str:match("X(%d+)Y(%d+)")
print(x, y)
1 Like

If it works, it works! Thanks for the help.