Use a regex to parse netmask.