Scooby Posted March 1, 2015 Share Posted March 1, 2015 Hi, could anyone tell me what i need to do to remove non alphabetical characters from a string? im writing a script to check the chat players use against a dictionary, i would like to be able to remove the non alphabetical characters so i can compare them with my stored word strings. eg: if i have the words: 'how are you?' i dont want to have to add a question mark to every stored word, so i want to remove these characters before i do the check. basically i need to change the string "you?" into "you" and so on for non alphabetical characters. maybe this could be done using string.gsub? i thought i would ask here because ive never used gsub before other than removing colour codes and im sure someone could help me quicker than me trying to work it out Link to comment
Dealman Posted March 1, 2015 Share Posted March 1, 2015 I'd use gsub, you can find the patterns/regular expressions here. Just have gsub remove the unwanted characters the exact same way you do with colour codes Link to comment
Scooby Posted March 1, 2015 Author Share Posted March 1, 2015 ok i'll try it. thanks. Link to comment
Et-win Posted March 1, 2015 Share Posted March 1, 2015 Also here: http://www.lua.org/pil/20.2.html Link to comment
Scooby Posted March 2, 2015 Author Share Posted March 2, 2015 thanks guys, I managed to get it working using %A Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now