You are viewing a single comment's thread. Return to all comments →
My python solution
import re number = int(input()) for n in range(number): string = input() if re.search(r'^([a-f0-9]{0,4}:[a-f0-9]{0,4}:[a-f0-9]{0,4}:[a-f0-9]{0,4}:[a-f0-9]{0,4}:[a-f0-9]{0,4}:[a-f0-9]{0,4}:[a-f0-9]{0,4})$', string): print('IPv6') elif re.search(r'^(([0-9]|[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$', string): print('IPv4') else: print('Neither')
Seems like cookies are disabled on this browser, please enable them to open this website
IP Address Validation
You are viewing a single comment's thread. Return to all comments →
My python solution