From 221774c6f8190ef6c4d301755afe03e85f5a5e48 Mon Sep 17 00:00:00 2001 From: Ezra Pagel Date: Mon, 21 Aug 2017 12:47:06 -0500 Subject: [PATCH] android_wrote regex was incorrectly iterating characters in 'wrote', resulting in greedy regex that matched many strings with dashes --- talon/quotations.py | 2 +- tests/text_quotations_test.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/talon/quotations.py b/talon/quotations.py index 7eb16ad..40e66d4 100644 --- a/talon/quotations.py +++ b/talon/quotations.py @@ -147,7 +147,7 @@ RE_FROM_COLON_OR_DATE_COLON = re.compile(u'(_+\r?\n)?[\s]*(:?[*]?{})[\s]?:[*]?.* RE_ANDROID_WROTE = re.compile(u'[\s]*[-]+.*({})[ ]*[-]+'.format( u'|'.join(( # English - 'wrote' + 'wrote', ))), re.I) # Support polymail.io reply format diff --git a/tests/text_quotations_test.py b/tests/text_quotations_test.py index 4163774..77ef08c 100644 --- a/tests/text_quotations_test.py +++ b/tests/text_quotations_test.py @@ -778,3 +778,16 @@ def test_split_email(): expected_markers = "stttttsttttetesetesmmmmmmssmmmmmmsmmmmmmmm" markers = quotations.split_emails(msg) eq_(markers, expected_markers) + + + +def test_feedback_below_left_unparsed(): + msg_body = """Please enter your feedback below. Thank you. + +------------------------------------- Enter Feedback Below ------------------------------------- + +The user experience was unparallelled. Please continue production. I'm sending payment to ensure +that this line is intact.""" + + parsed = quotations.extract_from_plain(msg_body) + eq_(msg_body, parsed.decode('utf8'))