format.EmailAddress Extends
Formats an email address string for display, and allows for extraction of the individual components of the address.

Inheritance

Constructor

goog.format.EmailAddress(opt_addressopt_name)

Parameters

opt_address : string=
The email address.
opt_name : string=
The name associated with the email address.

Instance Methods

Public Protected Private
getAddress() string
Get the email address.
Returns: string  The email address.
code »
getName() string
Get the name associated with the email address.
Returns: string  The name or personal portion of the address.
code »
isValid() boolean
Determines is the current object is a valid email address.
Returns: boolean  Whether the email address is valid.
code »
setAddress(address)
Set the email address.
Arguments:
address : string
The email address.
code »
setName(name)
Set the name associated with the email address.
Arguments:
name : string
The name to associate.
code »
toString() string
Return the address in a standard format: - remove extra spaces. - Surround name with quotes if it contains special characters.
Returns: string  The cleaned address.
code »

Instance Properties

address :
The email address.
Code »
name_ :
The name or personal string associated with the address.
Code »

Static Methods

goog.format.EmailAddress.getToken_(strpos) string
Get the next token from a position in an address string.
Arguments:
str : string
the string.
pos : number
the position.
Returns: string  the token.
code »
goog.format.EmailAddress.isEscapedDlQuote_(strpos) boolean
Checks if the character in the current position is an escaped double quote ( \" ).
Arguments:
str : string
the string.
pos : number
the position.
Returns: boolean  true if the char is escaped double quote.
code »
goog.format.EmailAddress.isValidAddrSpec(str) boolean
Checks if the provided string is a valid address spec (local@domain.com).
Arguments:
str : string
The email address to check.
Returns: boolean  Whether the provided string is a valid address spec.
code »
goog.format.EmailAddress.isValidAddress(str) boolean
Checks if the provided string is a valid email address. Supports both simple email addresses (address specs) and addresses that contain display names.
Arguments:
str : string
The email address to check.
Returns: boolean  Whether the provided string is a valid address.
code »
goog.format.EmailAddress.isValidDomainPartSpec(str) boolean
Checks if the provided string is a valid domain part (part after the '@') of an email address.
Arguments:
str : string
The domain part to check.
Returns: boolean  Whether the provided string is a valid domain part.
code »
goog.format.EmailAddress.isValidLocalPartSpec(str) boolean
Checks if the provided string is a valid local part (part before the '@') of an email address.
Arguments:
str : string
The local part to check.
Returns: boolean  Whether the provided string is a valid local part.
code »
goog.format.EmailAddress.parse(addr) !goog.format.EmailAddress
Parses an email address of the form "name" <address> into an email address.
Arguments:
addr : string
The address string.
Returns: !goog.format.EmailAddress  The parsed address.
code »
goog.format.EmailAddress.parseInternal(addrctor) !goog.format.EmailAddress
Parses an email address of the form "name" <address> ("name" is optional) into an email address.
Arguments:
addr : string
The address string.
ctor : function(new: goog.format.EmailAddress, string=,string=)
EmailAddress constructor to instantiate the output address.
Returns: !goog.format.EmailAddress  The parsed address.
code »
goog.format.EmailAddress.parseList(str) !Array.<!goog.format.EmailAddress>
Parses a string containing email addresses of the form "name" <address> into an array of email addresses.
Arguments:
str : string
The address list.
Returns: !Array.<!goog.format.EmailAddress>  The parsed emails.
code »
goog.format.EmailAddress.parseListInternal(strparser) !Array.<!goog.format.EmailAddress>
Parse a string containing email addresses of the form "name" <address> into an array of email addresses.
Arguments:
str : string
The address list.
parser : function(string)
The parser to employ.
Returns: !Array.<!goog.format.EmailAddress>  The parsed emails.
code »

Static Properties

goog.format.EmailAddress.ALL_BACKSLASHES_ :
A RegExp to match all backslashes. Used in cleanAddress().
Code »
goog.format.EmailAddress.ALL_DOUBLE_QUOTES_ :
A RegExp to match all double quotes. Used in cleanAddress().
Code »
goog.format.EmailAddress.CLOSERS_ :
Match string for closing tokens.
Code »
goog.format.EmailAddress.DOMAIN_PART_ :
A RegExp to match the domain part of an email address.
Code »
goog.format.EmailAddress.DOMAIN_PART_REGEXP_STR_ :
A string representing the RegExp for the domain part of an email address.
Code »
goog.format.EmailAddress.EMAIL_ADDRESS_ :
A RegExp to match an email address.
Code »
goog.format.EmailAddress.ESCAPED_BACKSLASHES_ :
A RegExp to match escaped backslashes. Used in parse().
Code »
goog.format.EmailAddress.ESCAPED_DOUBLE_QUOTES_ :
A RegExp to match escaped double quotes. Used in parse().
Code »
goog.format.EmailAddress.LOCAL_PART_ :
A RegExp to match the local part of an email address.
Code »
goog.format.EmailAddress.LOCAL_PART_REGEXP_STR_ :
A string representing the RegExp for the local part of an email address.
Code »
goog.format.EmailAddress.OPENERS_ :
Match string for opening tokens.
Code »
goog.format.EmailAddress.SPECIAL_CHARS_RE_ :
A RegExp to check special characters to be quoted. Used in cleanAddress().
Code »

Package format

Package Reference