Skip to content

allow using custom regexes #33

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

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

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.

1 participant