npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@clearfeed-ai/email-reply-parser

v2.0.2

Published

Node library for parsing plain text email content. Based on https://github.com/willdurand/EmailReplyParser

Readme

Email Reply Parser

Test and Build Build and Release NPM Downloads

Email Reply Parser is a node library to parse plain-text email replies and extract content

This library supports most email replies, signatures and locales.

😘 Maintainer: @baptistejamin

Who uses it?

👋 You use this library and you want to be listed there? Contact us.

Installation

Install the project using NPM:

npm install --save @clearfeed-ai/email-reply-parser

RE2 Support

By default, the library relies on the RE2 regex engine, which provides better performance and avoids issues like ReDOS. By default, RE2 will be installed as a peer dependency.

If you want to explicitly exclude RE2, then npm uninstall re2.

Features

This library is used at Crisp everyday with around 1 million inbound emails. Over the years, we improved this library so it can work with most emails.

  • Strip email replies like On DATE, NAME <EMAIL> wrote:
  • Supports around 10 locales, including English, French, Spanish, Portuguese, Italian, Japanese, Chinese.
  • Removes signatures like Sent from my iPhone
  • Removes signatures like Best wishes

Usage

var EmailReplyParser = require("@clearfeed-ai/email-reply-parser");

var email =  new EmailReplyParser().read(MY_EMAIL_STRING);

console.log(email.getVisibleText());

Basic Example

var EmailReplyParser = require("@clearfeed-ai/email-reply-parser");

var emailContent = `Hi there,

I appreciate your help with this issue.

Thanks!

On Jan 28, 2026, at 10:00 AM, Support <[email protected]> wrote:

> How can I help you?
> 
> Best regards,
> Support Team`;

var parser = new EmailReplyParser();
var reply = parser.parseReply(emailContent);

console.log(reply);
// Output: "Hi there,\n\nI appreciate your help with this issue."

Custom Regex Patterns

You can add custom header and signature regex patterns at runtime to handle specific email formats that aren't covered by the default patterns.

Adding Custom Quote Header Patterns

Quote headers are patterns that indicate quoted or forwarded content (e.g., "On DATE, NAME wrote:").

var EmailReplyParser = require("@clearfeed-ai/email-reply-parser");

var parser = new EmailReplyParser();

// Add one or more custom quote header regexes
parser.addQuoteHeaderRegexes([
  /^Forwarded by .+ on .+$/m,
  /^Original message from .+$/m,
  /^----- Reply from .+ -----$/m
]);

// Now parse emails with these custom patterns
var email = parser.read(emailContent);

Adding Custom Signature Patterns

Signature patterns identify signature lines that should be removed (e.g., "Sent from my iPhone", "Best regards").

var EmailReplyParser = require("@clearfeed-ai/email-reply-parser");

var parser = new EmailReplyParser();

// Add one or more custom signature regexes
parser.addSignatureRegexes([
  /^Sent via CompanyName Mobile$/,
  /^Thanks,?$/mi,
  /^Have a great day!?$/mi,
  /^Posted using MyApp$/
]);

// Now parse emails with these custom patterns
var email = parser.read(emailContent);

Resetting to Default Patterns

If you need to reset the patterns back to the defaults:

var EmailReplyParser = require("@clearfeed-ai/email-reply-parser");

var parser = new EmailReplyParser();

// Add custom patterns
parser.addQuoteHeaderRegexes([/^Custom pattern$/m]);

// Reset to default quote header patterns
parser.resetQuoteHeaderRegexes();

// Reset to default signature patterns
parser.resetSignatureRegexes();

Method Chaining

All custom regex methods support method chaining for convenience:

var EmailReplyParser = require("@clearfeed-ai/email-reply-parser");

var email = new EmailReplyParser()
  .addQuoteHeaderRegexes([/^Forwarded by .+$/m])
  .addSignatureRegexes([/^Sent via MyApp$/])
  .read(emailContent);

Note: Custom patterns are added globally and will affect all subsequent parsing operations. In multi-tenant environments, reset the patterns between tenants or avoid registering tenant-specific patterns globally.

Contributing

Feel free to fork this project and submit fixes. We may adapt your code to fit the codebase.

You can run unit tests using:

npm test

Credits

License

email-reply-parser is released under the MIT License. See the bundled LICENSE file for details.