In JavaScript:
/[^\w_]/g
^
negation, i.e. select anything not in the following set
\w
any word character (i.e. any alphanumeric character, plus underscore)
_
negate the underscore, as it's considered a 'word' character
Usage example - const nonAlphaNumericChars = /[^\w_]/g;