Hi. So i am on the ‘Spinal Tap Case’ challenge and i am stucked. I sneak peaked the solutin and i cannot really understand the regex which replaces UpperCase with space.
The first regex was easy enough for me to figure it out: let regex = /[\W\s+_]/g;.
But the regex i dont understand is this one: str = str.replace(/([a-z])([A-Z])/g, "$1 $2");
Can someone explain me how this works exactly? Which part of the regex identifies the space we add?
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36.
I know understood it! Thank you! I did not understand how we defined the space between them. The space is actually in the script “$1 here:D $2”. Got it, thanks again!