diff --git a/lib/regex.js b/lib/regex.js index c593bc9..ea6f839 100644 --- a/lib/regex.js +++ b/lib/regex.js @@ -20,6 +20,7 @@ class RegexList { /^(.+\s<.+>\sschrieb:)$/m, // NAME schrieb: /^(.+\son.*at.*wrote:)$/m, // NAME on DATE wrote: /^\s*(From\s?:.+\s?\n?\s*[\[|<].+[\]|>])/m, // "From: NAME " OR "From : NAME " OR "From : NAME"(With support whitespace before start and before <) + /^\s*(Von\s?:.+\s?\n?\s*[\[|<].+[\]|>])/m, // "Von: NAME " OR "Von : NAME " OR "Von : NAME"(With support whitespace before start and before <) /^\s*(De\s?:.+\s?\n?\s*(\[|<).+(\]|>))/m, // "De: NAME " OR "De : NAME " OR "De : NAME" (With support whitespace before start and before <) /^\s*(Van\s?:.+\s?\n?\s*(\[|<).+(\]|>))/m, // "Van: NAME " OR "Van : NAME " OR "Van : NAME" (With support whitespace before start and before <) /^\s*(Da\s?:.+\s?\n?\s*(\[|<).+(\]|>))/m, // "Da: NAME " OR "Da : NAME " OR "Da : NAME" (With support whitespace before start and before <) @@ -61,4 +62,4 @@ class RegexList { } } -module.exports = new RegexList(); \ No newline at end of file +module.exports = new RegexList(); diff --git a/test/fixtures/email_german_2.txt b/test/fixtures/email_german_2.txt new file mode 100644 index 0000000..3dfc0c3 --- /dev/null +++ b/test/fixtures/email_german_2.txt @@ -0,0 +1,12 @@ +Fusce bibendum, quam hendrerit sagittis tempor, dui turpis tempus erat, pharetra sodales ante sem sit amet metus. +Nulla malesuada, orci non vulputate lobortis, massa felis pharetra ex, convallis consectetur ex libero eget ante. +Nam vel turpis posuere, rhoncus ligula in, venenatis orci. Duis interdum venenatis ex a rutrum. +Duis ut libero eu lectus consequat consequat ut vel lorem. Vestibulum convallis lectus urna, +et mollis ligula rutrum quis. Fusce sed odio id arcu varius aliquet nec nec nibh. + +Von: John Doe +Gesendet: Donnerstag, 23. März 2023 17:11 +An: John Doe +Betreff: AW: Hi there! + +Hi there! diff --git a/test/test.js b/test/test.js index f0eb608..6c65661 100644 --- a/test/test.js +++ b/test/test.js @@ -267,6 +267,16 @@ exports.test_email_german = function(test) { test.done(); }; +exports.test_email_german_2 = function(test) { + let email = get_email("email_german_2"); + + let fragments = email.getFragments(); + + test.equal(COMMON_FIRST_FRAGMENT, fragments[0].toString().trim()); + + test.done(); +}; + exports.test_email_gmail_no = function(test) { let email = get_email("email_norwegian_gmail"); @@ -492,4 +502,5 @@ exports.test_email_original_message_2 = function(test) { test.equal(2, fragments.length); test.done(); -} \ No newline at end of file +} +