Explain this regex to me?

It is supposed to remove all duplicates in the string, but please fill in my knowledge of this as I’m not quite sure I understand…

function removeDupes(input){
	return input.replace(/[^\w\s]/gi, ``)
}

I know // starts regex, [] are for any of these characters, ^ is for the start of the string, \w is word, and \s is white space? I know /gi is global insensitive, and the empty string is to replace all of those instances with a blank. I guess what I’m having trouble with is understanding fully as to why, or mostly [^\w\s]

EDIT: Just tried in the console and it doesn’t even work, haha

If it’s the first character in brackets, ^ becomes something like a NOT-operator. So if [\w\s] matches a letter/number/underscore/whitespace, [^\w\s] matches a character that’s not any of those.