http://www.perlmonks.org?node_id=1065775


in reply to LDAP. Parantheses present in the filter cn value

Escaping them with a backslash (within double quotes the backslash is meaningful and must be escaped, so two of them) should work:

$ldap->search( base => $ldapbase, scope => "sub", filter => "(cn= John Wyner \\(DRAFT\\))" );
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: LDAP. Parantheses present in the filter cn value
by atcroft (Abbot) on Dec 05, 2013 at 15:48 UTC

    If shmem's suggestion does not work for you, then you may want to look at (untested) replacing the parens in question with their hex representations per RFC 4514, so the string becomes "(cn = John Wyner \64DRAFT\65)".

    Hope that helps.

Re^2: LDAP. Parantheses present in the filter cn value
by srini.here (Initiate) on Dec 09, 2013 at 12:58 UTC

    thanks a ton. that did help. :) :) :)