Modified val_ip4_*() functions to use regex matching.