string.find and spaces?

So I’m creating this kind of custom damagelog for TTT where basically you can type in “ttt_print_playerlog” then a portion of or all of the players name or steam ID. It will then go through all the players, find any that match and if it only matches one then it will continue.

It will search through a table which is a damage log, every part of the table is a string sudoing the damagelog, my problem is if the players name that it is searching for has a space it doesn’t seem to work. (At least that’s what I seem to find) the only special characters my name has in it are “[” “]” " ’ " and a space. while these are in my name string.find does not seem to want to work, is there a way of fixing this? I printed out string.lower of both the lines in the table and my name and it should match up.

[emp’g] 61352151511
00:05.40 - dmg: [emp’g] 61352151511 [traitor] damaged bot02 [innocent] for 20 dmg

But yet
– string.find(string.lower(damagetable*), string.lower(MatchingPlayers[1]:Nick()))
doesn’t want to work, damagetable* is the line in the damagelog (Me damaging bot2), MatchingPlayers[1]:Nick() is the person being searched for. Any help is appreciated

“[” and “]” are used to denote sets in pattern matching and therefore need to be escaped when you want to match them literally. You can either use string.gsub to escape them (prepend ‘%’ to them) or just turn off pattern matching when using string.find:

[lua]string.find(string.lower(damagetable*), string.lower(MatchingPlayers[1]:Nick()), 1, true)[/lua]

Solved, thanks