Had a situation where I wanted to split a guitar tuning string into an array of individual notes.
Well, cb diam la. I don’t want the empty strings. I found two ways of addressing this conundrum:
So the first approach uses a Lookahead regex, while the second approach calls filter() to remove the empty strings since they evaluate to false. Gonna have to look into this lookahead stuff. And the Ruby equivalent: