James Dennett wrote:
Square brackets don't "escape" thing that way: [[] is a character class
containing only the character '['. [][], however, is a character class
containing two characters. The special rule is that the first character
after the opening '[' is part of the class even if it's a ']' or a '-'.
James,
I don't think it is that simple.
What happens if, as in the OP, the character set is simply []? Is this
an empty character set, or is a set containing a ] but missing the
terminal ]?
According to your special rule above, it would be the latter, in which
case it should generate some kind of error message reporting the
unterminated character set.
If you say it is supposed to be greedy and include all characters it can
until the terminal ] before examining the set of characters it contains,
then this would be an empty character set. What does an empty set match?
Normally, a set matches any of the contained characters, but an empty
set can't match any character, so any pattern containing the empty set
would always fail. So, is an empty set a special case, that matches the
literal characters [] instead?
None of this is really clear and unambiguous from any of the
documentation I have seen so far.
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------