Fix Trac #5041: parse the trailing '#'