string:match( "[^%w%s]" )
This currently allows only letters, numbers and spaces as far as I understand. How can I add characters to it? For example I'd like to allow (
and _
too.
string:match( "[^%w%s(_]" )
This would add the characters you mentioned. Basically any character you add in the square brackets.
Some need to be escaped, such as parentheses.