Having a regexp has a cost in terms of CPU, that's why it's always better to compile the pattern once and check if it matches many times. That's how I understand @battags's comment.

So maybe, in the constructor of ```ProxyList```, you could iterate all over the proxies list, see if it's a regexp, and in this case, compile the pattern: ```Pattern.compile(string)``` and keep the ```Pattern```.

Finally, you would have ```Pattern```s and ```String```s and you could update the above test with ```instanceof``` checks, starting by the ```String``` as it seems more common, exactly like you propose.