On Mon, Nov 15, 2010 at 07:06:54AM -0500, Wietse Venema wrote:
Luca Berra:
[ Charset ISO-8859-1 unsupported, converting... ]
On Sun, Nov 14, 2010 at 07:28:46PM -0500, Wietse Venema wrote:
>Each pattern field is either a decimal number, or it is a numeric
>wildcard. Decimal numbers match themselves; for example the pattern
>127.0.0.2 matches the DNSXL result 127.0.0.2.  A numeric wildcard
>field matches one or more number values; for example, the pattern
>127.0.[1,2,11].[1-3] requires that the third DNSXL result field has
>the value 1 or 2 or 11, and that the fourth DNSXL result field is
>any decimal number in the range 1 through 3 inclusive.

I would suggest using a slightly different syntax for numeric wildcards.
Being those either lists or ranges i would use a syntax similar to the
one used by many shells for lists, plus the extensions introduced in zsh
and bash for ranges.
In practice enclosing numeric wildcards in braces, using comma as a list
separator and ".." as a range separator.
With this syntax your example above would become:
127.0.{1,2,11}.{1..3}
Having a different syntax will make it clear to the user we are not
dealing with regexp or glob patterns, and reduce the chance of
confusion.

What I describe is not list notation. Specifically, the glob {1,2,11}
means 1 AND 2 AND 11,  while the pattern [1,2,11] means 1 OR 2 OR 11.

   $ echo {1,2,11}
   1 2 11
   $ echo {1..11}
   1 2 3 4 5 6 7 8 9 10 11

If we want to avoid confusion, then we should not use AND notation
in places where OR operation is intended.

I understand that from you point of view you are
formally correct.
specifically because in shells brace expansion is not really related to
filename globbing.

but i was looking at it the other way around, so i see 1,2,11 as a
_list_ of possible matches

it is just a question of ergonomics, in either case we are overriding a
syntax (or using a syntax with some similarities to another), which one
will be clearer to the end user?

{1,2,11} and [1,2,11] are both clear
what about [12-45] versus {12..45} ?

L.


--
Luca Berra -- [email protected]

Reply via email to