Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
sanitize string wih gsub / pattern matching — Gideros Forum

sanitize string wih gsub / pattern matching

Hi, I think it's a stupid question but I can't wrap my head around this: I guess I am missing something trivial.

I need to sanitize two user inserted strings:

sanitize A should keep every alphanumeric character, spaces and punctuation

sanitize B should keep only lowercase a-z: no spaces, no punctuation, no numbers

I wonder why my gsub never works:
this should be my implementation of sanitize B, where the output in my dreams should be "elephant" :|
local testring = "134àelephantù#.!$ 4"
--string.gsub(testring,"[^a-z]", "")
testring:gsub("[^a-z]", "")
print("TEST STRING", testring)
thank you :)

Comments

Sign In or Register to comment.