Article View: news.software.nntp
Article #66856New NNTP draft -- Section 4
From: Russ Allbery
Date: Sat, 18 Oct 2003 21:32
Date: Sat, 18 Oct 2003 21:32
158 lines
8174 bytes
8174 bytes
[ See <http://www.davros.org/nntp-texts/draft20.txt> for the complete
document, including credits and references. This is the first in a
series of postings of the sections of the new NNTP draft, which is
currently in Last Call. ]
NNTP C. Feather
Internet-Draft Thus plc
Expires: April 15, 2004 October 16, 2003
4. The WILDMAT format
The WILDMAT format described here is based on the version first
developed by Rich Salz [SALZ1992], which in turn was derived from the
format used in the UNIX "find" command to articulate file names. It
was developed to provide a uniform mechanism for matching patterns in
the same manner that the UNIX shell matches filenames.
4.1 Wildmat syntax
A wildmat is described by the following ABNF [RFC2234] syntax (note
that this syntax contains ambiguities and special cases described at
the end):
wildmat = wildmat-pattern *("," ["!"] wildmat-pattern)
wildmat-pattern = 1*wildmat-item
wildmat-item = wildmat-exact / wildmat-wild
wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A / %x5E-7E /
UTF8-non-ascii ; exclude * , ? [ \ ]
wildmat-wild = "*" / "?"
UTF8-non-ascii is defined in Section 9.
This syntax must be interpreted subject to the following rule:
Where a wildmat-pattern is not immediately preceded by "!", it shall
not begin with a "!".
Note: the characters \ , [ and ] are not allowed in wildmats, while *
and ? are always wildcards. This should not be a problem since these
characters cannot occur in newsgroup names, which is the only current
use of wildmats. Backslash is commonly used to suppress the special
meaning of characters while brackets are used to introduce sets.
However, these usages are not universal and interpretation of these
characters in the context of UTF-8 strings is both potentially
complex and differs from existing practice, so they were omitted from
this specification. A future extension to this specification may
provide semantics for these characters.
4.2 Wildmat semantics
A wildmat is tested against a string, and either matches or does not
match. To do this, each constituent wildmat-pattern is matched
against the string and the rightmost pattern that matches is
identified. If that wildmat-pattern is not preceded with "!", the
whole wildmat matches. If it is preceded by "!", or if no
wildmat-pattern matches, the whole wildmat does not match.
For example, consider the wildmat "a*,!*b,*c*":
the string "aaa" matches because the rightmost match is with "a*"
the string "abb" does not match because the rightmost match is
with "*b"
the string "ccb" matches because the rightmost match is with "*c*"
the string "xxx" does not match because no wildmat-pattern matches
A wildmat-pattern matches a string if the string can be broken into
components, each of which matches the corresponding wildmat-item in
the pattern; the matches must be in the same order, and the whole
string must be used in the match. The pattern is "anchored"; that is,
the first and last characters in the string must match the first and
last item respectively (unless that item is an asterisk matching zero
characters).
A wildmat-exact matches the same character (which may be more than
one octet in UTF-8).
"?" matches exactly one character (which may be more than one octet).
"*" matches zero or more characters. It can match an empty string,
but it cannot match a subsequence of a UTF-8 sequence that is not
aligned to the character boundaries.
4.3 Extensions
An NNTP server or extension MAY extend the syntax or semantics of
wildmats provided that all wildmats that meet the requirements of
Section 4.1 have the meaning ascribed to them by Section 4.2. Future
editions of this document may also extend wildmats.
4.4 Examples
In these examples, $ and @ are used to represent the two octets %xC2
and %xA3 respectively; $@ is thus the UTF-8 encoding for the pound
sterling symbol, shown as # in the descriptions.
Wildmat Description of strings that match
abc the one string "abc"
abc,def the two strings "abc" and "def"
$@ the one character string "#"
a* any string that begins with "a"
a*b any string that begins with "a" and ends with "b"
a*,*b any string that begins with "a" or ends with "b"
a*,!*b any string that begins with "a" and does not end with
"b"
a*,!*b,c* any string that begins with "a" and does not end with
"b", and any string that begins with "c" no matter
what it ends with
a*,c*,!*b any string that begins with "a" or "c" and does not
end with "b"
?a* any string with "a" as its second character
??a* any string with "a" as its third character
*a? any string with "a" as its penultimate character
*a?? any string with "a" as its antepenultimate character
Full Copyright Statement
Copyright (C) The Internet Society (2003). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assignees.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID:
<871xta1bbb.fsf@windlord.stanford.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!text1.nnrp.aus1!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nf3.bellglobal.com!snoopy.risq.qc.ca!headwall.stanford.edu!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mailReferences:
<87fzhryxdc.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <871xta1bbb.fsf@windlord.stanford.edu> Subject: New NNTP draft -- Section 4 Date: Sat, 18 Oct 2003 14:32:40 -0700 From: Russ Allbery <rra@stanford.edu> References: <87fzhryxdc.fsf@windlord.stanford.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!text1.nnrp.aus1!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nf3.bellglobal.com!snoopy.risq.qc.ca!headwall.stanford.edu!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail Newsgroups: news.software.nntp Organization: The Eyrie Lines: 158 NNTP-Posting-Host: windlord.stanford.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.Stanford.EDU 1066512760 960 171.64.19.147 (18 Oct 2003 21:32:40 GMT) X-Complaints-To: news@news.stanford.edu User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Common Lisp, linux) Cancel-Lock: sha1:UZToaweSQcoK7EuQ4xalZ8KNTvw=