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

Why do all the $quoteHeadersRegex have a beginning (^) and end ($) regex? #91

Open
davidnagli opened this issue Mar 22, 2023 · 1 comment

Comments

@davidnagli
Copy link

davidnagli commented Mar 22, 2023

I am using this to parse emails, but my emails are in unparsed, raw HTML (because I plan to later display them on a webpage and I want to preserve their formatting). The problem is that since this this package uses /^\s*(On(?:(?!.*On\b|\bwrote:)[\s\S])+wrote:)$/m to match the quote headers, if I don't parse and get rid of all the tags (which I don't want to do), the EmailReplyParser fails to parse the quoted headers since technically they are not on the beginning of the line.

Here's a simple example:

<p>On Wednesday, March 22, 2023, 3:25 PM, XXX <XXXX.com> wrote:</p>

To get around this, I removed the ^ and $ from the regular expression which fixed the problem, but I was wondering if maybe there was some original motivation behind having it there in the first place... I don't want to remove something on my end that will break something for me down the line.

Is there a reason for the ^ and $ (beginning and end matching)?

If yes, I suppose there's another workaround where I can use the end of the previous HTML tag "/>" as the "beginning".

@osdiab
Copy link

osdiab commented Dec 6, 2024

I'm actually not using this library ,but probably the rationale is that

EmailReplyParser is a PHP library for parsing plain text email content

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

2 participants