- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How to validate text in install script?
- 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
I want to have only string without using special characters in text box.
How to validate it? How to use Regex in install shield code?
Regards,
Vasanth
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @vasanthakumarmk ,
How about adding function which will get substring of given string character by character and validate based on string operator %.?
pseudo code would be:
prototype IsSpecialChar (string);
function IsSpecialChar (szStuff)
/* Check if a string has special charecter
In: szStuff -- string to test
Out: Returns TRUE or FALSE
*/
#define SPECIAL_CHARS "%$#@*)(+~"
// For my purposes, underscore is considered alphanumeric.
number nPos;
string szChar;
begin
for nPos = 0 to StrLength (szStuff)
StrSub (szChar, szStuff, nPos - 1, 1);
if !(SPECIAL_CHARS % szChar) then
return FALSE;
endif;
endfor;
return TRUE;
end;
Hope it helps,
Thanks,
Jenifer
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @vasanthakumarmk ,
How about adding function which will get substring of given string character by character and validate based on string operator %.?
pseudo code would be:
prototype IsSpecialChar (string);
function IsSpecialChar (szStuff)
/* Check if a string has special charecter
In: szStuff -- string to test
Out: Returns TRUE or FALSE
*/
#define SPECIAL_CHARS "%$#@*)(+~"
// For my purposes, underscore is considered alphanumeric.
number nPos;
string szChar;
begin
for nPos = 0 to StrLength (szStuff)
StrSub (szChar, szStuff, nPos - 1, 1);
if !(SPECIAL_CHARS % szChar) then
return FALSE;
endif;
endfor;
return TRUE;
end;
Hope it helps,
Thanks,
Jenifer
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
