I have some code which is behaving strangely and I am not sure why. I am attempting to validate the user input is a number and that it is less than 255. Pretty easy.
Problem is that numbers from 26 to 99 are not valid for me in my testing. 1-25 are fine, and 100+ seem fine too.. but for some reason 26-99 keep me in the loop.
DO
{
$ip_addr_first = Read-Host 'enter a number less than 255'
} while ($ip_addr_first -notmatch '\p{Nd}+' -or $ip_addr_first -gt 255)
write-host 'You entered' $ip_addr_first
suggestions welcome on where the problem is, as I'm at a loss here.