Accepting partial playernames?

I believe this could be done with some string.match and patterns, but I don’t know specifics. What I mean is that instead of having to say ban mistclxvds, you could say ban mis, ban mist, etc. I’ve seen this done in many admins. Here is my code so far for detecting the playername, if you need it:

for i, v in pairs(Players:GetPlayers()) do
		if string.lower(v.Name) == string.lower(Victim) then
			Player = v
		end
	end --This code doesn't need to worry about caps, but it needs exact playernames.
--For example, I could say "ban mistClXVdS", but not "ban mis".

Help appreciated.

I found this topic:

For more clarifty, I believe this is the portion of the code that you wanted:

for _, player in ipairs(game:GetService("Players"):GetPlayers()) do 
	if player.Name:lower():sub(1, #target) == target then
		player:Kick("Kicked by an admin")
		break
	end
end
2 Likes