Yes. You can write a plugin to do so which includes a filter module. You'll want to focus on the filter_handle() method.
This method will almost make the whole plugin for you: https://github.com/q2a/question2answer/blob/4fce0eb2390f56b645dad375d1d81e9f91a97e69/qa-include/plugins/qa-filter-basic.php#L41 . Just copy/paste, remove the unneeded stuff and change the regular expression to whatever you want, which I get the impression should be something close to '/[^0-9a-zA-Z]/', based on your comments.