I checking string for a non-alphanumeric char.
if(str:match("%W")) then
--make str alpha-numeric
end
How to remove all non-alphanumeric chars from string using lua?
I checking string for a non-alphanumeric char.
if(str:match("%W")) then
--make str alpha-numeric
end
How to remove all non-alphanumeric chars from string using lua?
Use gsub (as suggested by Egor Skriptunoff):
str = str:gsub('%W','')
just make it like this you forgot +
if(str:match("%W+")) then --if it contain alpha
number = str:match("%d+")
alpha = str:match("%W+")
end