I'm writing an IMAP4 backup app. After much research I have found the correct IMAP command to return all messages or a range of messages.
SS01 UID FETCH 1:* BODY[]
This beautiful command returns data in to following format:
* 1 FETCH (UID 2 BODY[] {7765}
data to be extracted
from here! which can possibly contain
) <--- one or more prior to its final...
)
* 2 FETCH (UID 3 BODY[] {443}
data to be extracted
from here! which can possibly contain
) <--- one or more prior to its final...
)
* 3 FETCH (UID 4 BODY[] {4432}
data to be extracted
from here! which can possibly contain
) <--- one or more prior to its final...
)
* 4 FETCH (UID 5 BODY[] {123}
data to be extracted
from here! which can possibly contain
) <--- one or more prior to its final...
)
SS01 OK Success
The only unique patterns I am able to find in this text are:
The very first message begins with...
1 FETCH (UID 2 BODY[] {7765}
Each message that is not the last ends with....
)
* 2 FETCH (UID 3 BODY[] {443}
The last message ends with...
)
SS01 OK Success
I have found the following example on the site that I am trying to implement but with no success.
The RegEx pattern is:
(?<=This is)(.*)(?=sentence)
Here's is a minimum reproducible example that doesn't work.
(\*\s\d+\s\w+\s\(UID\s\d+\sBODY\[\]\s\{\d+\})(.*\n)(\)\n\*\s\d+\s\w+\s\(UID\s\d+\sBODY\[\]\s\{\d+\})