> -----Original Message----- > From: Dennis Cote [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 23, 2008 3:08 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Query problem > > 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 ]?
That's not a valid specification of a character class. > 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. That would be appropriate; the alternative (which bash appears to use) is to take it as two literal characters. > 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. No, because there *is* no terminal ]. (The first character after the opening '[' is *never* the end of the character class: that's exactly the special rule.) > What does an empty set match? Nothing, but you'd have to specify exclusion of every character. > 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? That's not an empty character class; it's not a character class at all. The POSIX/Single Unix Spec documentation for fnmatch might be a good source, but I agree with the idea that SQLite should just document what it does rather than assuming that there's a universal standard for globbing. -- James ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------