Remove all non-letter characters from the lua string

I am checking a string for non-alphanumeric char.

if(str:match("%W")) then --make str alpha-numeric end 

How to remove all non-alphanumeric characters from a string using lua?

+4
source share
1 answer

Use gsub (as suggested by Egor Skriptunov):

 str = str:gsub('%W','') 
+8
source

Source: https://habr.com/ru/post/1479414/


All Articles