in reply to IP address matching

I was wondering if you have written any code so we can help you.

I've written something like this a few times recently. No error checking but then again I was pulling from my apache access_log. I wanted it all including any invalid. Let us know what you have tried.