util_email_valid_p (public)

 util_email_valid_p query_email

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Returns 1 if an email address has more or less the correct form. The initial regexp was taken from Jeff Friedls book "Mastering Regular Expressions". It was later updated with the version proposed by mozilla for the email input type validation. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation

Parameters:
query_email (required)
Authors:
Philip Greenspun <philg@mit.edu>
Jeff Friedl <jfriedl@oreilly.com>
Lars Pind <lars@arsdigita.com>
Héctor Romojaro
Günter Ernst

Testcases:
host_admin_and_outgoing_sender, util_email_valid_p
Source code:
    # This regexp was very kindly contributed by Jeff Friedl, author of
    # _Mastering Regular Expressions_ (O'Reilly 1997).
    # return [regexp "^\[^@<>\"\t ]+@\[^@<>\".\t ]+(\\.\[^@<>\".\n ]+)+$" $query_email]

    # Improved regexp from the folks at mozilla:
    # https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation
    return [regexp {^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$} $query_email]
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: