Search filters use one of the following formats:
-
<filter>=(<attribute><operator><value>)
-
(<operator><filter1><filter2>)
In this example, <attribute> stands for the LDAP display name of the attribute by which you want to search.
Search filters use one of the following formats:
<filter>=(<attribute><operator><value>)
(<operator><filter1><filter2>)
In this example, <attribute> stands for the LDAP display name of the attribute by which you want to search.
The following table lists some frequently used search filter operators.
Logical Operator |
Description |
= |
Equal to |
~= |
Approximately equal to |
<= |
Lexicographically less than or equal to |
>= |
Lexicographically greater than or equal to |
& |
AND |
| |
OR |
! |
NOT |
You can add wildcards and conditions to a search filter. The following examples show substrings that can be used to search the directory.
Substring |
Description |
---|---|
(objectClass=*) |
Get all entries |
(cn=*bob*) |
Get entries containing bob somewhere in the common name |
(cn>='bob') |
Get entries with a common name greater than or equal to bob |
(&(objectClass=user)(mail=*)) |
Get all users with an email attribute |
(&(sn=smith)(objectClass=user)(mail=*)) |
Get all user entries with an email attribute and a surname equal to smith |
(&(objectClass=user) | (cn=andy*)(cn=steve)(cn=margaret)) |
Get all user entries with a common name that starts with andy, steve, or margaret |
(!(mail=*)) |
Get all entries without an email attribute |
If any of the following special characters must appear in the search filter as literals, they must be replaced with the listed escape sequence.
ASCII Character |
Escape Sequence Substitute |
* |
\2a |
( |
\28 |
) |
\29 |
\ |
\5c |
NUL |
\00 |
In addition, arbitrary binary data may be represented using the escape sequence syntax by encoding each byte of binary data with the backslash (\) followed by two hexadecimal digits. For example, the four-byte value 0x00000004 is encoded as \00\00\00\04 in a filter string.
© 2024 One Identity LLC. ALL RIGHTS RESERVED. Nutzungsbedingungen Datenschutz Cookie Preference Center