Match IP address pattern and print out the index