Spinal tap case problem solving using replace single time is it possible?

Tell us what’s happening:
Describe your issue in detail here.
Why my this code is not working I have tried to replace characters between small letters and capital letters

  **Your code so far**

function spinalCase(str) {
// "It's such a fine line between stupid, and clever."
// --David St. Hubbins
 console.log(str
  .replace(/(?<=[a-z])\s+|_+|(?=[A-Z])/g,"-")
  .toLowerCase())
return str
  .replace(/(?<=[a-z])\s|_|(?=[A-Z])/,"-")
  .toLowerCase();
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 OPR/79.0.4143.72

Challenge: Spinal Tap Case

Link to the challenge:

What problems are you having? In what way is it not working? What results are you getting and how do they compare with what you expect?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.