Expand my Community achievements bar.

problem with a pattern

Avatar

Former Community Member
I have a problem with a pattern.

I want to put a patter to validate an e-mail but i don´t find the way to do it
2 Replies

Avatar

Former Community Member
Hi Veloki,

You can drag and drop custom "email Adress" object from Custom Object Library. It includes the script for email validation in the validate event of email area.



// Validate the email address.

var r = new RegExp("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,3}$"); // Create a new Regular Expression Object.

// Set the regular expression to look for an email address in general form.



var result = r.test(this.rawValue); // Test the rawValue of the current object to see



// if it fits the general form of an email address.

if (result == true) // If it fits the general form,

true; // all is well.

else // Otherwise,

false; // fail the validation.



Asiye