-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiline quote regex #43
Comments
I can't comment on your pr, but your issue does bring up a question i've been trying to resolve. The above regex seems to only match the final 'On ,.. wrote:' in a multi reply chain. (because the lookahead prevents any 'On...On...wrote:' and also because the .*? is non-greedy). Subsequently, the code replaces any \n in the match with ''. (I notice they use 2 regexes, but since neither has an explict anchor I believe they are equivalent). In any case, this is causing errors in reply-chain parsing in the case where an non-end of chain quoted email has a newline in the quote header because those don't get fixed and thus don't get recognized as headers. It seems like it should be matching each quote header not just the final one? |
Currently, there is no constraint between On and wrote:
_MULTI_QUOTE_HDR_REGEX = r'(?!On.*On\s.+?wrote:)(On\s(.+?)wrote:)'
.So, even if there is a million characters between On ... blah blah blah ... wrote: it still detects as a multiline quote.
I think the gap between On and wrote: needs to be controlled.
I discovered this bug when the library took 1 minute to parse a long email with multiple On and wrote.
I'm creating a PR for this.
The text was updated successfully, but these errors were encountered: