Properly handle anchors for names containing dots and '