So for the case in my first comment, you have to trim, strip, and trim again.

Or just strip all the damn whitespace and slashes off the right-hand side. The first `.trim()` is just to catch a leading whitespace.

I'm also open to "this is way more complicated than it needs to be."