Skip to content

Conversation

bjoveski
Copy link

Allow using custom regexes for email parsing

This PR adds the ability to customize the regular expressions used for parsing email content.

Changes

  • Added new options parameter to the parse function that accepts custom regex patterns
  • Updated TypeScript definitions to include the new options interface
  • Modified the Parser constructor to accept custom regex patterns

Usage Example

const parse = require('node-email-reply-parser');

const customOptions = {
  signatureRegex: /^--\s*$/,
  quotedLineRegex: /^>.*$/,
  quoteHeadersRegex: [/^On.*wrote:$/]
};

const result = parse(emailContent, false, customOptions);

Why

This change allows users to customize the parsing behavior to match their specific email format requirements, making the library more flexible and adaptable to different email formats and conventions.

Changelog [Improvements/Email Parser]: Added support for custom regular expressions in email parsing to handle different email formats

Copy link

@damien-thiesson damien-thiesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

2 participants