I have a script that runs periodically to convert the hostnames given in DHCP leases into static DNS entries.
Unfortunately, some of the DHCP clients use illegal characters, which result in less-than-useful DNS entries.
I’ve tried to engineer a snippet to fix this, but I can’t quite wrap my brain around it.
I want to loop through a string, removing any characters not in [-0-9a-zA-Z].