- I liked
/[^a-zA-Z\d]/g
(“not a letter or a number”) except that as this commenter pointed out, it would also remove letters with accents - So,
/[^\w\d]/gi
is likely safer (“not a word, a digit or whitespace” as a way to end up with “symbols”)
script.sh
#!/usr/bin/env bash