Skip to content

Latest commit

 

History

History
95 lines (75 loc) · 2.39 KB

split-email.md

File metadata and controls

95 lines (75 loc) · 2.39 KB

Split Email

The SPLIT-EMAIL directive splits an email ID into an account and its domain.

Syntax

split-email <column>

The <column> is a column containing an email address.

Usage Notes

The SPLIT-EMAIL directive will parse email address into its constituent parts: account and domain.

After splitting the email address, the directive will create two new columns, appending to the original column name:

  • column_account
  • column_domain

If the email address cannot be parsed correctly, the additional columns will still be generated, but they would be set to null depending on the parts that could not be parsed.

Examples

Using this record as an example:

{
  "name": "Root, Joltie",
  "email_address": "[email protected]",
}

Applying this directive:

split-email email_address

would result in this record:

{
  "name": "Root, Joltie",
  "email_address": "[email protected]",
  "email_address_account": "root",
  "email_address_domain": "example.com"
}

In case of any errors parsing: when the email address field in the record is null:

{
  "email": null
}

this would result in the record:

{
  "email": null,
  "email_account": null,
  "email_domain": null
}

Using these records as an example, with a variety of email IDs:

[
  { "email": "[email protected]" },
  { "email": "[email protected]" },
  { "email": "[email protected]" },
  { "email": "joltie.'@.'root.'@'[email protected]" },
  { "email": "Joltie, Root <[email protected]>" },
  { "email": "Joltie,Root<[email protected]>" },
  { "email": "Joltie,Root<[email protected]" }
]

running the directive results in these records:

[
  { "email": "[email protected]", "email_account": "root", "email_domain": "cask.co" },
  { "email": "[email protected]", "email_account": "joltie.xxx", "email_domain": "gmail.com" },
  { "email": "[email protected]", "email_account": "joltie_xxx", "email_domain": "hotmail.com" },
  { "email": "joltie.'@.'root.'@'[email protected]", "email_account": "joltie.'@.'root.'@'.", "email_domain": "yahoo.com" },
  { "email": "Joltie, Root <[email protected]>", "email_account": "joltie.root", "email_domain": "hotmail.com" },
  { "email": "Joltie,Root<[email protected]>", "email_account": "joltie.root", "email_domain": "hotmail.com" },
  { "email": "Joltie,Root<[email protected]", "email_account": null, "email_domain": null }
]