Replace cidr_merge algorithm with something that doesn't use regexes.