Regexps problem

Duff bruno.dusausoy at skynet.be
Thu Dec 12 09:46:51 EST 2002


On Thu, 12 Dec 2002 15:38:40 +0100, Duff wrote:

I've forgot to include an example ...
Here it is:


>>>server.select()
>>>('OK', ['(\\HasNoChildren) "." "INBOX.Test.Sous Test"',
'(\\HasChildren) "." "INBOX.Test"', '(\\HasNoChildren) "."
"INBOX.Trash"', '(\\Unmarked \\HasChildren) "." "INBOX"'])
>>>

I don't care about the first tuple element ('OK')
I want to have : 
INBOX.Test.Sous Test
INBOX.Test
INBOX.Trash
INBOX

> Hi,
> 
> I use the imaplib module to communicate with my IMAP4 server.
> 
> Whe i ask the server which mailboxes are there, it returns a tuple
> containing a string and a list of mailboxes (with their attributes).
> What interest me is this list. Each list item is a string It contains 3
> "parts" :
> - mailbox attributes consisting of one or more words (separated by a
> whitespace )preceded by '\' and encapsulated by two parenthesis '(' and
> ')' Ex : (\Haschildren \Unmarked) or (\Hasnochildren) - hierarchy
> delimiter consisting in one character (it could be any character)
> encapsulated by two "  (Example : "." or "/") - mailbox name :
> consisting in a string encapsulated by two " (Example : "Test" or
> "Test.SubTest")
> 
> What i'd like to do is isolate the mailboxes names. How can I do that
> with regexps ?
> 
> Thanks ..
> 
> --
> Dusausoy Bruno



More information about the Python-list mailing list