to the original URI in order to construct the next domain name
to lookup. The grammar of the substitution expression is given
in the next section.
Replacement
The next NAME to query for NAPTR, SRV, or A records depending
on the value of the flags field. As mentioned above, this may
be compressed.
Substitution Expression Grammar:
================================
The content of the regexp field is a substitution expression. True
sed(1) substitution expressions are not appropriate for use in this
application for a variety of reasons, therefore the contents of the
regexp field MUST follow the grammar below:
subst_expr = delim-char ere delim-char repl delim-char *flags
delim-char = "/" / "!" / ... (Any non-digit or non-flag character other
than backslash '\'. All occurances of a delim_char in a
subst_expr must be the same character.)
ere = POSIX Extended Regular Expression (see [13], section
2.8.4)
repl = dns_str / backref / repl dns_str / repl backref
dns_str = 1*DNS_CHAR
backref = "\" 1POS_DIGIT
RFC 2168 Resolution of URIs Using the DNS June 1997
flags = "i"
DNS_CHAR = "-" / "0" / ... / "9" / "a" / ... / "z" / "A" / ... / "Z"
POS_DIGIT = "1" / "2" / ... / "9" ; 0 is not an allowed backref
value domain name (see RFC-1123 [14]).
The result of applying the substitution expression to the original
URI MUST result in a string that obeys the syntax for DNS host names
[14]. Since it is possible for the regexp field to be improperly
specified, such that a non-conforming host name can be constructed,
client software SHOULD verify that the result is a legal host name
before making queries on it.
Backref expressions in the repl portion of the substitution
expression are replaced by the (possibly empty) string of characters
enclosed by '(' and ')' in the ERE portion of the substitution
expression. N is a single digit from 1 through 9, inclusive. It
specifies the N'th backref expression, the one that begins with the
N'th '(' and continues to the matching ')'. For example, the ERE
(A(B(C)DE)(F)G)
has backref expressions:
\1 = ABCDEFG
\2 = BCDE
\3 = C
\4 = F
\5..\9 = error - no matching subexpression
The "i" flag indicates that the ERE matching SHALL be performed in a
case-insensitive fashion. Furthermore, any backref replacements MAY
be normalized to lower case when the "i" flag is given.
The first character in the substitution expression shall be used as
the character that delimits the components of the substitution
expression. There must be exactly three non-escaped occurrences of
the delimiter character in a substitution expression. Since escaped
occurrences of the delimiter character will be interpreted as
occurrences of that character, digits MUST NOT be used as delimiters.
Backrefs would be confused with literal digits were this allowed.
Similarly, if flags are specified in the substitution expression, the
delimiter character must not also be a flag character.
RFC 2168 Resolution of URIs Using the DNS June 1997
Advice to domain administrators:
================================
Beware of regular expressions. Not only are they a pain to get
correct on their own, but there is the previously mentioned
interaction with DNS. Any backslashes in a regexp must be entered
twice in a zone file in order to appear once in a query response.
More seriously, the need for double backslashes has probably not been
tested by all implementors of DNS servers. We anticipate that urn.net
will be the heaviest user of regexps. Only when delegating portions
=8= |