in reply to Matching Sequential IP Addresses

The only thing I can think of is have 255 if statements

Set a state variable to 1. Use a foreach. Construct the IP address. If it's not valid, set the state to 0 and exit the loop.