The current regex already doesn't allow for whitespace forming part of either the <number> or <units> segments so this should be trivial.
For the original intended use case, no space makes sense, e.g. working with strings like "50em" or "10px".
However the parse-unit example is "50 gold" and having a space is perfectly reasonable there.
So for added utility we should allow (but not require) whitespace in input strings with units (i.e. in parseString().