跳到主要内容

2. 字符串搜索过滤器定义

LDAP 搜索过滤器的字符串表示由以下 BNF 定义. 它采用前缀格式.

  <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>

是表示 AttributeType 的字符串, 其格式在 [1] 中定义. 是表示 AttributeValue 或其一部分的字符串, 其格式在 [2] 中定义. 如果某个 必须包含字符 '*' , '(' , 或 ')' 中的一个, 则应在这些字符前加反斜杠 '' 字符对其进行转义.