Skip to content
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

Multiple regex captures for **with** field regex #130

Open
ItayBenAvi opened this issue Feb 6, 2025 · 0 comments
Open

Multiple regex captures for **with** field regex #130

ItayBenAvi opened this issue Feb 6, 2025 · 0 comments

Comments

@ItayBenAvi
Copy link

Describe the bug
Multiple regex captures for with field regex
This is captured by const.py:47 using the following regex:
(?:with(?! cipher)\s+(?P.+?)(?:\s*[(]?envelope-from|\s*[(]?envelope-sender|\s+from|\s+by|\s+id|\s+for|\s+via|;))

To Reproduce
Use the following line for testing:
from abc.com 1.1.1.1 by edc.com OK with SMTP id ABCDEF123456 using TLSv1.2 with cipher ABCDEF-123456 Client didn't present a certificate

Resolution
Make the regex greedy in order to match the first with occurrence:
(?:with(?! cipher)\s+(?P.+?)(?:\s*[(]?envelope-from|\s*[(]?envelope-sender|\s+from|\s+by|\s+id|\s+for|\s+via|;)).*

Expected behavior
Match the first with statement

Environment:

  • OS: Linux
  • Docker: yes
  • mail-parser version: 4.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant