Added Japanese, Simplified Chinese and Korean #49

Merged
merged 1 commit into from Dec 25, 2016

Projects

None yet

3 participants

@sigginet
Contributor
sigginet commented Nov 8, 2016

Added Japanese, Simplified Chinese and Korean quote headers and "Send from my" lines.

@stof

New tests should be added covering your case

@@ -21,7 +21,7 @@ class EmailParser
/**
* Regex to match signatures
*/
- const SIG_REGEX = '/(?:^\s*--|^\s*__|^-\w|^-- $)|(?:^Sent from my (?:\s*\w+){1,3})$/s';
+ const SIG_REGEX = '/(?:^\s*--|^\s*__|^-\w|^-- $)|(?:^(Sent from my)|(发自我的) (?:\s*\w+){1,3})|(?:^나의(?:\s*\w*)(에서\s보냄)|(から送信))$/s';
@stof
stof Nov 8, 2016 Contributor

these should be non-capturing groups.
And putting the | outside the new groups looks wrong to me, as it changes the regex entirely for the English case (the new English regex is anchored at the beginning, but not at the end)

@sigginet
sigginet Nov 8, 2016 Contributor

Well spotted.
A test was created.
I restored the original SIG_REGEX since I wasn't able to get the tests to pass.
Systems will just have to suffer and see the "Sent from my iPhone" in multilingual versions a little bit longer.

@sigginet @sigginet sigginet Added Japanese, Simplified Chinese and Korean
Added Japanese, Simplified Chinese and Korean quote headers and "Send from my" lines.
3dba775
@sigginet
Contributor

@stof any other modifications that need to be done to this?

@willdurand willdurand merged commit 204142b into willdurand:master Dec 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@willdurand
Owner

Thanks and sorry for the delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment