"Matt Hunter" <…@lfurio.us> writes:
> It's unfortunate how long this bullet becomes with all the interjections
> stating "/" is excluded. I tried to write a version of this myself to
> condense the explanation. It's not much shorter, but is maybe easier to
> follow? I dunno.
>
> - A pair of brackets that enclose characters matches any single
> character from the listed characters, and a range notation inside
> them, e.g., "`[a-zA-Z]`", behaves as if all the characters in the
> range were listed there instead. However a leading "`!`" or "`^`"
> negates the list. A slash character "`/`" can not be matched using
> this construct, even if the list is negated or a range containing a
> slash is present. Wildcard characters "`*`" and "`?`" lose their
> special meaning inside a pair of brackets, e.g., "`[*]`" matches an
> asterisk and nothing else.
This improves over mine on two points by unifying the cases to have
individual characters case and character range in a pair of
brackets, and by stating more explicitly how negation and '/'
exclusion interacts. It probably makes sense to fold the [*?] into
the description on "any single character from the listed characters".
... listed there instead. Wildcard characters "`*`" and
"`?`"' lose their special meaning inside a pair of brackets,
e.g., ... nothing else.
I personally feel that this also disimproves on two points, though.
- "However a leading ... negates the list." makes it sound as if it
is a bad thing. It is an additional useful feature, and I'd
prefer to phrase it as such. E.g.,
The list can be negated by having "`!`" or "`^`" as the
first character in the bracket, e.g., "`[^0-9]`" matches
characters that are not ASCII digits.
- "A slash character cannot be matched" also makes it sound as if
it is a bad thing. Wildcard sequence matching only one path
component at a time is a feature, and I'd prefer to phrase it as
such.
Neither bracket construct (negated or not) nor a wildcard
matches the slash "`!`" character, which is matched only by
itself (e.g., the pattern "`a/b*`" matches `a/bc` but not
`a/b/c`).
Also, it might make it easier to read if we split this large single
bullet into three, by the way. (1) brackets, (2) negation, (3)
slash-exclusion.
What do you think?