Generation

generate functionSat, 12 Nov 2022

match any ip address

def match_ip(ip): regex = r'^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$' if re.match(regex, ip): return True else: return False match_ip('1.1.1.1')

Questions about programming?Chat with your personal AI assistant