You can attach this function to the stage symbol in the stage compositionReady event handler like below:
sym.IsEmail = function (email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
and then can use this function anywhere like this: sym.IsEmail (emailToXYZ); //where sym denotes the stage symbol
hth,
Vivekuma