Mentiong usernames with trailing underscore does not work

We have also seen on the WTDWTF install (running 1.5.0b2) that @username_ mentions don’t mention properly, either resulting in the name not getting formatted as a mention, or the name formatting as a mention, but clicking on the @mention does not bring up a user card, unless you click specifically on the underscore (any other section of the mention is “dead” to click on).