I am working on this assignment on free code camp, and for some reason, which I can't seem to figure out, I am not getting the correct output. My debug logs seem to occur as expected, but it seems as though I'm missing something. I have used string.replace() before with an anonymous function, and it worked fine. In this case, I don't seem to be actually replacing my matches on the string as expected, and I imagine it has something to do with using the regex for matches.
I can't figure out how to make this go. Any help would be appreciated.
Code:
function convertHTML(str) {
  var re = new RegExp('[$\"\'\<\>&]', 'g');
  str.replace(re, function (match) {
    console.log("match");
    console.log(match);
    switch (match) {
      case "&":
        return "&";
      case "$":
        return "$";
      case '"':
        return """;
      case "'":
        return "'";
      case "<":
        return "<";
      case ">":
        return ">";
    }
    console.log("oops");
  });
  console.log(str);
  return str;
}
convertHTML("Dolce & Gabbana");
convertHTML("Hamburgers < Pizza < Tacos");
convertHTML("Sixty > twelve");
convertHTML('Stuff in "quotation marks"');
convertHTML("Shindler's List");
convertHTML("<>"); 
    