This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- how to validate email address is correct or not in installscript?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 04, 2015
01:23 PM
how to validate email address is correct or not in installscript?
Hi
I want to check the given email address (e.g abc@gmail.com) is correct or wrong in installscript.
Is it Possible in Installscript?
thanks,
Thananjeyan
I want to check the given email address (e.g abc@gmail.com) is correct or wrong in installscript.
Is it Possible in Installscript?
thanks,
Thananjeyan
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 05, 2015
12:31 PM
Thananjeyan.M wrote:
Hi
I want to check the given email address (e.g abc@gmail.com) is correct or wrong in installscript.
Is it Possible in Installscript?
thanks,
Thananjeyan
There is not a super easy way, but see the following thread for a solution that others have used:
h t t p s : / / community.flexerasoftware.com/showthread.php?160858-Problems-calling-VBScript-COM-objects-from-InstallScript&p=358149#post358149
https://community.flexerasoftware.com/showthread.php?160858-Problems-calling-VBScript-COM-objects-from-InstallScript&p=358149#post358149
Here's a little context around that thread: someone else needed to check the validity of an e-mail address, and the eventual solution was to use a regular expression. InstallScript does not use regular expressions, so the thread shows how to work around that.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 15, 2015
04:49 PM
As Evan metioned, I used the VB Script function in InstallscriptMSI project
Called the function as follows
[CODE]
emailPattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";
svEmail = abc@gmail.com;
if (!ValidateString(svEmail,emailPattern)) then
MessageBox ("Invalid format for an email address.", INFORMATION);
else
MessageBox ("Valid email address.", INFORMATION);
[/CODE]
prototype BOOL ValidateString(STRING, VARIANT);
function BOOL ValidateString(szString,szPattern)
OBJECT oRegEx;
BOOL MatchFound;
begin
//try to create the RegEx object
try
set oRegEx = CoCreateObject("VBScript.RegExp");
catch
MessageBox("CoCreateObject Failed- "+ Err.Decription, SEVERE);
endcatch;
oRegEx.Pattern = szPattern;
oRegEx.IgnoreCase = 0;
MatchFound = oRegEx.Test(szString);
set oRegEx = NOTHING;
return MatchFound;
end;
Called the function as follows
[CODE]
emailPattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";
svEmail = abc@gmail.com;
if (!ValidateString(svEmail,emailPattern)) then
MessageBox ("Invalid format for an email address.", INFORMATION);
else
MessageBox ("Valid email address.", INFORMATION);
[/CODE]