Another thing you should add is to remove items that have already been
matched from the items you continue trying to match :) think about the
following data ..
100000
..
..
123450
first item is 1*, there are then 70 other regexps to run ... the first
expression will in fact select every node.
Cheers,
Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
"Mike Davies" <mike@(cutmeout)scrappy.freeserve.co.uk> wrote in message
news:h5l5a2pqod2oi7karqv34qh2m3c7cn3g23@4ax.com...[color=blue]
> 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[/color]