regex is correct but some issue in the script

Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 11:25 AM
Hi,
I wrote the regex for validating the email ID, but the problem is coming with respect to the code. Kindly help.
function onSubmit() {
var email_ID = g_form.getValue("email");
var testEmail = /^([a-z0-9A-Z\_\.]*)@([a-z\.]*)$/;
if (!testEmail.test(email_ID)) {
g_form.addErrorMessage("invalid email");
return false;
}
return true;
Regards
Suman P.
12 REPLIES 12

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 11:28 PM
Hi @Amit Pandey ,
I copied your script and tried to use it and I get "Invalid email format" on the top.
Regards
Suman P.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 11:36 PM
What is your current email format?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 11:41 PM
Hi @Amit Pandey ,
is is from incident table. So, it is coming from caller - > email. Do you think email is the correct format?
Regards
Suman P.