Algorithm scripting..spinal tap case

please guys help me out. i have been trying to come out with the solution but my code only passes the first 3 tests… how do i improve on this code to pass all the tests.

let a = str.replace(/[^a-z0-9]+/gi,"");
  let b = a.split(/(?=[A-Z])/).join("-");
  let c = b.toLowerCase();
  
  return c;

thanks man. I did as you said and was able to pass all the tests…