Hi,
The regular expression just parses the data that comes with the
email ... e.g. (a part) of the message is like this:
(X-GM-LABELS ("\\Inbox") UID 5835 INTERNALDATE "17-Aug-2010 15:16:54
+0000" FLAGS () BODY[] {21993}
The regular expresion just finds the "labels" associated with that
particular message ("Inbox" in this case), the UID (5385),
internaldate (17-Aug-2010 15:16:54 +0000) and the flags (none here ...
but it would be something like 'seen' or other gmail specific flags).
The labels are then split (shlex.split) into multiple labels before
they are inserted into the db. If your subfolder structure was
something like Folder1/Folder2/Folder3/Folder1 (notice that Folder1 is
getting repeated), then during insertion in the db, this would have
caused a duplicated which would generate an error.
SS