ANSWER:

You use brackets to 'capture' a string, like so:

local str = "ee3eaae1"
print(string.match(str,"(%d+)")) -- string pattern 'd' returns a digit
-- prints '3'

I am making a script that gets a number from the name of a model, then turns it into a number value and uses it as a key for a table, like so:

local tab = {}

for _,v in pairs (modelHolder:GetChildren()) do
	local name = v.Name
	local num = ... -- code to get number
	tab[num] = v
end

The problem is, I thought string.match() returned the string it matched if you used a pattern. Apparently it doesn't, though, so I am stuck. This is my code (everything has been defined, obviously):

for _,v in pairs (mapFolder:GetChildren()) do
	local name = v.Name
	local num = string.match(name,"Stage%d+")
	local num2 = string.match(name,num.."-%d+")
	print(num,num2)
	num = tonumber(num)
	num2 = tonumber(num2)
	if num then
		maps[num] = v
		if num2 then
			for i = 1,num2-num-1 do
				maps[num+i] = v
			end
		end
	end
end

Thank you!

~TDP