MDL-43430: Enrolments lost when user is member of a group with parenthesis in it's name

As part of fixing MDL-43430, it has been detected a typo in the
quoted alphanumeric characters (the '=' and '>' were transposed).
MDL-43430: Enrolments lost when user is member of a group with parenthesis in it's name

The group names we get from ldap_find_user_groups() can contain invalid LDAP
filter characters. In fact, they are returned escaped as they are distinguished
names (dn), so we need to dn-unescape them first and then escape then for
LDAP filter usage.

While testing the fix, it was found that ldap_stripslashes() was broken and
using a deprecated PCRE patter modifier, so it's also been fixed.