github / github/email_reply_parser

Signature regular expression

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
708
Forks
156
PR merge metrics
No merged PRs in 30d

Description

I ran into some random situations where emails were not parsed correctly. Part of the email was chopped out, for example:
`Hi Test,\n\n-This is a test`
Will result in `-This is a test` fragment being hidden and considered as part of signature which it should not be. After digging more into the problem, we figured out that:
`(?m)(--\s*$|__\s*$|\w-$)|(^(\w+\s*){1,3} ym morf tneS$)`
The first matching group is testing against `\w-`, which is causing the problem. I can't think out of a better way to solve the problem other than take `\w-$` part out so it opens to any suggestion.

Contributor guide

Open the contributing guide

Research direction

Start with the signature regular expression shown in the issue and reproduce the provided email example to inspect why the fragment is classified as a signature. Confirm the matching behavior after deciding how the \w-$ alternative should be handled, and verify that the sample fragment remains visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.