in reply to Script to input IP Address and Subnet Bits (10.3.2.0/28)
A relatively simple (and too permissive) regex would be:
if ($qs =~ /^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*(\/\d+)?$/) { # do stuff with $qs } [download]