Merge remote-tracking branch 'theavgjojo/master'

* theavgjojo/master:
  UPDATED: improving email address splitting for common comma case
This commit is contained in:
Tim Wojtulewicz 2022-08-11 10:41:08 -07:00
commit e618be094a
5 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,7 @@
5.1.0-dev.382 | 2022-08-11 10:41:08 -0700
* UPDATED: improving email address splitting for common comma case (TheAvgJojo)
5.1.0-dev.380 | 2022-08-11 10:30:33 -0700
* Fix a crash related to a broken IPv6 chain (Tim Wojtulewicz)

View file

@ -1 +1 @@
5.1.0-dev.380
5.1.0-dev.382

View file

@ -58,7 +58,7 @@ function extract_first_email_addr(str: string): string
function split_mime_email_addresses(line: string): set[string]
{
local output = string_set();
local addrs = find_all(line, /(\"[^"]*\")?[^,]+/);
local addrs = find_all(line, /(\"[^"]*\")?[^,]+@[^,]+/);
for ( part in addrs )
{
add output[strip(part)];

View file

@ -13,6 +13,11 @@ three@example.com,
two@example.com,
one@example.com
}
{
three@example.com,
two@example.com,
one@example.com
}
one@example.com
[one@example.com, two@example.com, three@example.com, one@example.com]
{
@ -26,9 +31,17 @@ john.smith@email.com
john.smith@email.com,
jane.doe@email.com
}
{
"Smith, John" <john.smith@email.com>,
"Doe, Jane" <jane.doe@email.com>
}
john.smith@email.com
[john.smith@email.com, jane.doe@email.com]
{
john.smith@email.com,
jane.doe@email.com
}
{
"Smith, John" <john.smith@email.com>,
"Doe, Jane" <jane.doe@email.com>
}

View file

@ -11,6 +11,7 @@ s = "one@example.com,two@example.com,three@example.com,one@example.com";
print extract_first_email_addr(s);
print extract_email_addrs_vec(s);
print extract_email_addrs_set(s);
print split_mime_email_addresses(s);
s = "ieje one@example.com, eifj two@example.com, asdf three@example.com, one@example.com";
print extract_first_email_addr(s);
print extract_email_addrs_vec(s);
@ -19,7 +20,9 @@ s = "\"Smith, John\" <john.smith@email.com>, \"Doe, Jane\" <jane.doe@email.com>"
print extract_first_email_addr(s);
print extract_email_addrs_vec(s);
print extract_email_addrs_set(s);
print split_mime_email_addresses(s);
s = "\"Smith, John\" <john.smith@email.com>,\"Doe, Jane\" <jane.doe@email.com>";
print extract_first_email_addr(s);
print extract_email_addrs_vec(s);
print extract_email_addrs_set(s);
print split_mime_email_addresses(s);