How do I write a regular expression that includes all keyboard characters except \'~\' and \',\'?
Have you tried this?
[^~,]
Now to exclude characters not in keyboard, I believe you have to include them all.
[a-zA-Z0-9\t\n ./<>?;:"'`!@#$%^&*()\[\]{}_+=|\\-]
Which pretty much covers it (even though it looks like a crazy way to get things done). Maybe the problem definition can help you add more stuffs to exclude in the first list [^~,]
than try to create a huge list of all keyboard chars.