IBM Support

Cast Iron Custom JavaScript to validate email address

Question & Answer


Question

Where can I find an example of custom JavaScript to validate email address in Cast Iron.

Answer

Below is a JavaScript example to validate an email address:

Input: Parameter of type Text or string containing the email address.
Output: Will return the text string of the email address if it satisfies the regular expression specified. If the email address is incorrect, an empty string is returned.


var elementValue = emailToValidate;
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
if(emailPattern.test(elementValue)){
return emailToValidate;
}
else
{
return '';
}

[{"Product":{"code":"SSGR73","label":"IBM Cast Iron Cloud Integration"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0.0.1;6.4.0.1;6.1.0.3;5.0.1.7","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

00001474

Document Information

More support for:
IBM Cast Iron Cloud Integration

Software version:
7.0.0.1, 6.4.0.1, 6.1.0.3, 5.0.1.7

Document number:
153639

Modified date:
15 June 2018

UID

swg21472012

Manage My Notification Subscriptions