What does this /(?:underscore| )+/ regex match? Isn’t “?:” for non-capturing?
Why does this split the string at each “underscore” if it is not to be matched?
str.split(/(?:_| )+/)
function spinalCase(str) {
str = str.replace(/([a-z])([A-Z])/g, "$1 $2");
str = str.toLowerCase();
str = str.split(/(?:_| )/g);
str = str.join("-");
};
spinalCase('The_Andy_Griffith_Show');
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
.
Challenge: Spinal Tap Case
Link to the challenge: