This was asked a bit ago in the Community question - there is good information on regex as well as querying an IP