The following abstract defines an EmailAddress type based on the String type which will use a regular expression to validate the passed argument as an e-mail address. If the address isn't valid, an exception will be thrown.
abstract EmailAddress(String) {
static var ereg = ~/^[\w-\.]{2,}@[\w-\.]...