Email address regular expression

Posted: 13 May 2009 in Custom instantiation, Data Capture Template, FormsPublisher, Teamsite, Worfklow models, Workflows

More often than not, you have email addresses to validate. Here’s a Perl regular expression that should do it nice and easy for you.

^(\w|\-|\_|\.|\'|\#|\$|\*|\/|\^|\!|\%|\=|\||\~|\{|\})+\@((\w|\-|\_)+\.)+[a-zA-Z]{2,}$

This can be used in a data capture template to validate the email address

<item name="email" pathid="email">
    <label>Email address</label>
    <description>Please enter a valid email address (e.g. john.doe@acme.com)</description>
    <text validation-regex="^(\w|\-|\_|\.|\'|\#|\$|\*|\/|\^|\!|\%|\=|\||\~|\{|\})+\@((\w|\-|\_)+\.)+[a-zA-Z]{2,}$">
        <default>john.doe@acme.com</default>
    </text>
</item>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s