Make anchor generation work with grouped stripped chars

This commit is a continuation of ac165188 so that grouped stripped chars
are now correctly stripped out (like "::" when referencing a namespaced
object for instance).

In response to a comment in #385.