public boolean validatePhoneNumber(MobileNo _mobileNo)
{
Str MatchEmailPattern = @"[0-9]";
System.Text.RegularExpressions.Match myMatch;
myMatch = System.Text.RegularExpressions.Regex::Match(_mobileNo,MatchEmailPattern);
return myMatch.get_Success();
}
Showing posts with label validations in Dynamics. Show all posts
Showing posts with label validations in Dynamics. Show all posts
Thursday, 13 December 2012
Tuesday, 4 December 2012
Number Validation
static void TextBuffer_regularExpression(Args _args)
{
TextBuffer txt = new TextBuffer();
str msg = “98797897″;
;
txt.setText(msg);
txt.regularExpressions(true); // activate regular expr in search
// Regular expression to validate only digits
if (txt.find(“^[0-9]+$”))
{
info(“string contains only numbers”);
}
}
{
TextBuffer txt = new TextBuffer();
str msg = “98797897″;
;
txt.setText(msg);
txt.regularExpressions(true); // activate regular expr in search
// Regular expression to validate only digits
if (txt.find(“^[0-9]+$”))
{
info(“string contains only numbers”);
}
}
URL Validation
Static Server boolean validateURL(URL _url)
{
Boolean valid;
Boolean xppBool;
System.Boolean netBool;
Str matchURLPattern = “^(https?://)”
+ “?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?” //user@+ @”(([0-9]{1,3}\.){3}[0-9]{1,3}” // IP- 199.194.52.184+ “|” // allows either IP or domain+ @”([0-9a-z_!~*'()-]+\.)*” // tertiary domain(s)- www.+ @”([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.” // second level domain+ “[a-z]{2,6})” // first level domain- .com or .museum+ “(:[0-9]{1,4})?” // port number- :80+ “((/?)|” // a slash isn’t required if there is no file name+ “(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$”;
System.Text.RegularExpressions.Match myMatch;
new InteropPermission(InteropKind::ClrInterop).assert();
myMatch = System.Text.RegularExpressions.Regex::Match(_url,matchURLPattern);
netBool = myMatch.get_Success(); xppBool = netBool;
CodeAccessPermission::revertAssert(); Return xppBool;
}
{
Boolean valid;
Boolean xppBool;
System.Boolean netBool;
Str matchURLPattern = “^(https?://)”
+ “?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?” //user@+ @”(([0-9]{1,3}\.){3}[0-9]{1,3}” // IP- 199.194.52.184+ “|” // allows either IP or domain+ @”([0-9a-z_!~*'()-]+\.)*” // tertiary domain(s)- www.+ @”([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.” // second level domain+ “[a-z]{2,6})” // first level domain- .com or .museum+ “(:[0-9]{1,4})?” // port number- :80+ “((/?)|” // a slash isn’t required if there is no file name+ “(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$”;
System.Text.RegularExpressions.Match myMatch;
new InteropPermission(InteropKind::ClrInterop).assert();
myMatch = System.Text.RegularExpressions.Regex::Match(_url,matchURLPattern);
netBool = myMatch.get_Success(); xppBool = netBool;
CodeAccessPermission::revertAssert(); Return xppBool;
}
Email validation
Static Server boolean validateEMail(EMail _eMail)
{
Boolean valid; Boolean xppBool;
System.Boolean netBool;
Str MatchEmailPattern = @”^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@”+ @”((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.”+ @”([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|”+ @”([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$”;
System.Text.RegularExpressions.Match myMatch;
new InteropPermission(InteropKind::ClrInterop).assert();
myMatch = System.Text.RegularExpressions.Regex::MatchnetBool = (_eMail,MatchEmailPattern);
myMatch.get_Success(); xppBool = netBool;
CodeAccessPermission::revertAssert(); Return xppBool;
}
{
Boolean valid; Boolean xppBool;
System.Boolean netBool;
Str MatchEmailPattern = @”^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@”+ @”((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.”+ @”([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|”+ @”([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$”;
System.Text.RegularExpressions.Match myMatch;
new InteropPermission(InteropKind::ClrInterop).assert();
myMatch = System.Text.RegularExpressions.Regex::MatchnetBool = (_eMail,MatchEmailPattern);
myMatch.get_Success(); xppBool = netBool;
CodeAccessPermission::revertAssert(); Return xppBool;
}
Subscribe to:
Posts (Atom)