Stop gerrit's commit link detection from mangling MediaWiki Urls

The regular expression to detect and decorate links to git commits in
texts (commit messages, plain comments, and inline comments)
did not check for characters before the hexadecimal string. So it
matched on Urls in commit messages that contained a sufficiently long
number, as for example

  Per talk on https://de.wikipedia.org/w/index.php?title=Benutzer_Diskussion:Raymond&oldid=115044733#Lua_in_weiteren_Wikipedien

For the above link, Gerrit wrapped the https link itself in an <a>
element, but also the oldid parameter, which resulted in garbled
output. Since fixing the highlighting directly in Gerrit is
unproportionally more complicated, we fix the problem for us by
restricting the characters that may occur before a commit hash.

Bug: #45780
Change-Id: I53449559bdcb70146102a7b07bb4be9ae3b11e48