Tell us what’s happening:
Not getting any idea to create regex to pass all test cases.
**Your code so far**
function spinalCase(str) {
let regSpace = /\s|_/g;
str = str.replace(/([a-z])([A-Z])/g, "$2 $1");
console.log(str);
return str;
}
spinalCase('this Is_Spinal Tap');
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Challenge: Spinal Tap Case
Link to the challenge:
Can you describe the logical steps that you need to go through? Trying to write regular expressions without a clear plan mostly just makes a mess. What do you need to do? What have you got working so far? What pieces are missing?
Thanks for replying but, I got the solution. I was actually trying to remove the capital letter and add space at the same line. Now I got it done.
Congratulations on figuring it out! Happy coding.
1 Like
system
Closed
February 15, 2022, 8:59am
#5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.