The string representation of an LDAP search filter is defined by the following grammar. It uses a prefix format.
<filter> ::= '(' <filtercomp> ')' <filtercomp> ::= <and> | <or> | <not> | <item> <and> ::= '&' <filterlist> <or> ::= '|' <filterlist> <not> ::= '!' <filter> <filterlist> ::= <filter> | <filter> <filterlist> <item> ::= <simple> | <present> | <substring> <simple> ::= <attr> <filtertype> <value> <filtertype> ::= <equal> | <approx> | <greater> | <less> <equal> ::= '=' <approx> ::= '~=' <greater> ::= '>=' <less> ::= '<=' <present> ::= <attr> '=*' <substring> ::= <attr> '=' <initial> <any> <final> <initial> ::= NULL | <value> <any> ::= '*' <starval> <starval> ::= NULL | <value> '*' <starval> <final> ::= NULL | <value>
<attr>
is a string representing an attribute, or key, in the properties objects of the registered services. Attribute names are not case sensitive; that is cn and CN both refer to the same attribute. <value>
is a string representing the value, or part of one, of a key in the properties objects of the registered services. If a <value>
must contain one of the characters '*
' or '(
' or ')
', these characters should be escaped by preceding them with the backslash '\
' character. Note that although both the <substring>
and <present>
productions can produce the 'attr=*'
construct, this construct is used only to denote a presence filter. Examples of LDAP filters are:
"(cn=Babs Jensen)" "(!(cn=Tim Howes))" "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))" "(o=univ*of*mich*)"
The approximate match (~=
) is implementation specific but should at least ignore case and white space differences. Optional are codes like soundex or other smart "closeness" comparisons.
Comparison of values is not always straightforward. Strings are compared differently than numbers and it is possible for a key to have multiple values. Note that that he comparison is defined by the String comparison rules.
|
|
|
|
|
|
|
|