Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including addressparser with all npm packages installed. Try it out:

var addressparser = require("addressparser")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

addressparser v1.0.1

Parse e-mail addresses


Parse e-mail address fields. Input can be a single address (""), a formatted address ("Andris Reinman <>"), comma separated list of addresses (","), an address group (";") or a mix of all the formats.

In addition to comma the semicolon is treated as the list delimiter as well (except when used in the group syntax), so a value ";" is identical to ",".


Install with npm

npm install addressparser


Include the module

var addressparser = require('addressparser');

Parse some address strings with addressparser(field)

var addresses = addressparser('andris <>');
console.log(addresses); // [{name: "andris", address:""}]

And when using groups

addressparser('Composers:"Bach, Sebastian" <>, (Mozzie);');

the result would be

        name: "Composers",
        group: [
                address: "",
                name: "Bach, Sebastian"
                address: "",
                name: "Mozzie"

Be prepared though that groups might be nested.


This module does not decode any mime-word or punycode encoded strings, it is only a basic parser for parsing the base data, you need to decode the encoded parts later by yourself




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free