M
Mike Davies
Hi Everyone,
Is there a better way of doing the following?
I have 2 lists. List 1 is a list of MAC addresses and List 2 is a list
of regular expressions. A user is only allowed to view devices that
match their list of regular expressions.
Small example:
List1
-------
0011223344
0022334455
0011225544
List2
-------
001122.*
002233.*
Now the only way I can see of doing this is to have a foreach loop for
List 1 and then nest a foreach loop for list2.
Pseudo Code
foreach(item in list1)
{
foreach(item in list2)
{
if (list1.item is a match on list2 regular expression)
{
Write(This device is allowed!)
break;
}
}
}
Seems a very inefficient way of doing it but can;t think of any othe
way to match list1 to list2? BTW, List1 could get quite large and
List2 could be a fair size as well.
Any ideas,
Thanks
Is there a better way of doing the following?
I have 2 lists. List 1 is a list of MAC addresses and List 2 is a list
of regular expressions. A user is only allowed to view devices that
match their list of regular expressions.
Small example:
List1
-------
0011223344
0022334455
0011225544
List2
-------
001122.*
002233.*
Now the only way I can see of doing this is to have a foreach loop for
List 1 and then nest a foreach loop for list2.
Pseudo Code
foreach(item in list1)
{
foreach(item in list2)
{
if (list1.item is a match on list2 regular expression)
{
Write(This device is allowed!)
break;
}
}
}
Seems a very inefficient way of doing it but can;t think of any othe
way to match list1 to list2? BTW, List1 could get quite large and
List2 could be a fair size as well.
Any ideas,
Thanks