Fair enough, but I favor changing the if condition as in my first example. And, in the OP's code any value (including zero) was going to become the empty string when the regex failed.
But the subtle problem you raise could well bite others. I'm also looing forward to //= installed most everywhere.