
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 05:09 AM
Since I cannot use the Question Regular Expression for a multi line text variable in a catalog item, I'm trying to do the reg ex validation for email addresses through a catalog client script. However I can't get it to work properly.
Can anyone please help me to get the right value for the regex. I tried several combinations
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var regex = '-----BEGIN EMAIL VALIDATION-----^([a-zA-Z0-9])$-----END EMAIL VALIDATION-----';
//Regex for RSA key (Private part)
if(!newValue.match(regex)){
g_form.addErrorMessage('Please enter valid email addresses.');
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 11:25 PM
Thank you @Community Alums
I had to alter the code a little bit to have it work:
if (!newValue.match(/^[a-zA-Z0-9\_\-\.]+@[a-zA-Z0-9\_\-\.]+\.[a-zA-Z]{2,5}$/)) {
g_form.showFieldMsg("google_group_members_00","Please enter a valid email ID","Error");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 11:25 PM
Thank you @Community Alums
I had to alter the code a little bit to have it work:
if (!newValue.match(/^[a-zA-Z0-9\_\-\.]+@[a-zA-Z0-9\_\-\.]+\.[a-zA-Z]{2,5}$/)) {
g_form.showFieldMsg("google_group_members_00","Please enter a valid email ID","Error");
}