Why are we capturing the separator?

Also the first part of the regex should probably be (^.+) since variable names shouldn't be empty string