Spinal Tap Case
The execise was a bit challenging to but though I had an idea of using regular expression to solve the problem.
Problem
Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.
Approach
I first search the word spinal case which was camelCase and from there I though of using regular expressions and but I got stuck which then I had to remind myself some of the regular expression properties.
I was also given a helpful link about String.prototype.replace() which also helped me a lot to solve the problem I was given.
I assigned a variable name string to treat string as single line and should be case-insensitive globally.
I replaced all a-z characters to be in range, replaced spaces with dashes and lastly all the capital letters made them to be lower case.
Conclusion
I struggled when it comes to regex properties because I couldn’t recall all the properties that I was supposed to use inoder to solve the problem I was given and I had no choice but to google regex properties.