to describe the problem:
I have some text with mail-header-lines like
From: me
To: you
Subject: welcome, this is a long line of subject with two
lines of text
Attachements: welcome.jpg, foo.pdf
the last line ('Attachements: welcome.jpg, foo.pdf') is OPTIONAL. so maybe this text only looks like
From: me
To: you
Subject: welcome, this is a short line of subject
I need to extract the Subject-Line(s), without the text 'Subject:'. leading and trailing whitespace are no problem.
the only operation I can use is a SINGLE QT-Regex-call that returns a FULL MATCH ONLY.
great, isn't it ?
I tried with success
(?<=Subject:)(?:\s*)(.*)(?=Attachements:)
but how do I make the 'Attachements:'-line optional ?
When there is no Attachement:-line, I expect the text/string to end with the Subject:-line(s).
any idea ?