I have a string that looks like this: \"Doe, John, A\" (lastname, firstname, middle initial).
I\'m trying to write a regular expression that converts the string into \"D
If you want to replace all non-word characters try this:
str.replace(/\W+/g, '*');