RFC 中的"*"(星号)是什么意思?



引自 https://www.rfc-editor.org/rfc/rfc5987#section-3.2.1:

为了包含字符集和语言信息,this
规范将 RFC 2616 语法修改为:

 parameter     = reg-parameter / ext-parameter
 reg-parameter = parmname LWSP "=" LWSP value
 ext-parameter = parmname "*" LWSP "=" LWSP ext-value
 parmname      = 1*attr-char
 ext-value     = charset  "'" [ language ] "'" value-chars
               ; like RFC 2231's <extended-initial-value>
               ; (see [RFC2231], Section 7)
 charset       = "UTF-8" / "ISO-8859-1" / mime-charset
 mime-charset  = 1*mime-charsetc

*parmname = 1*attr-char中是什么意思?还有同样的问题在mime-charset = 1*mime-charsetc.

我所知道的是,"*"的意思是* ext-parameter = parmname "*" LWSP "=" LWSP ext-value本身,因为RFC显示了ext-parameter = parmname "*" LWSP "=" LWSP ext-value的后面一个例子:

title*=iso-8859-1'en'%A3%20费率

它是一个描述有效重复次数的量词。

"1*元素"至少需要一个元素。

请参阅 RFC 2616 第 2.1 节 - 增强型 BNF:

*rule
      The character "*" preceding an element indicates repetition. The
      full form is "<n>*<m>element" indicating at least <n> and at most
      <m> occurrences of element. Default values are 0 and infinity so
      that "*(element)" allows any number, including zero; "1*element"
      requires at least one; and "1*2element" allows one or two.

你引用的规范说:

此规范使用 ABNF(Augmented Backus-Naur Form(
[RFC5234] 中定义的表示法。 包括以下核心规则通过引用,如[RFC5234]附录B.1:ALPHA(字母(中所定义,DIGIT(十进制 0-9(、HEXDIG(十六进制 0-9/A-F/a-f(和 LWSP
(线性空格(。

转到 RFC 5234,您会发现 https://www.rfc-editor.org/rfc/rfc5234#section-3.6

最新更新