Recognize branches

Change regex to recognize branches which are defined by an
optional `#`.

Match only for lowercase chars as git shas are always lowercase
with numbers.

This should fix npm/npm#5090