Why string pattern "%d%d%d%d%d%d" after appling on ANY input will return nil?

Hello, I’m trying make string pattern which will allow write only numbers in textBox. But my filter “%d%d%d%d%d%d” just erase EVERYTHING: numbers, symbols, letters. Can someone help me?

BrushConnections[#BrushConnections + 1] = TextInput:GetPropertyChangedSignal("Text"):Connect(function()
	if TextInput:IsFocused() == true then
		print("Text was: " .. TextInput.Text)
		print("Now text is: " .. tostring(string.match(TextInput.Text, "%d%d%d%d%d%d")))
		TextInput.Text = if (string.match(TextInput.Text, "%d%d%d%d%d%d")) ~= nil then string.match(TextInput.Text, "%d%d%d%d%d%d") else ""
	end
end)
--Input: 1
--Output: nil
--Should: 1
--Input: g
--Output: nil
--Should: nil

Also, there’s no any other functions which will erase string.

Found solution:
I was needed to type “%d?%d?%d?%d?%d?%d?”, bc there was possible to have less than 6 numbers. But I have 1 question left - why this string pattern worked earlier like I wanted?