void main()
{
.....
SortedList VLans_LIST = new SortedList();
foreach (string CurrRegex in new string[] { "^(?
{
string VLanValidated = RegEX_Validate(CurrRegex , "vlan", ipAddress);
if (VLanValidated == null)
{ //do nothing }
else if (!VLans_LIST.Contains(VLanValidated))
{
VLans_LIST.Add(VLanValidated, VLanValidated);
}
}
}
string RegEX_Validate(string RegexString, string RegexValueParam,string StringToVal)
{
Regex objNaturalPattern = new Regex(RegexString);
if (objNaturalPattern.Match(StringToVal).Success )
{
Match VMatch = objNaturalPattern.Match(StringToVal);
return VMatch.Groups[RegexValueParam].Value;
}
else return null;
}
No comments:
Post a Comment