http://qs1969.pair.com?node_id=513814


in reply to Script to input IP Address and Subnet Bits (10.3.2.0/28)

You're not matching for the "/XX" part, and the second regex also matches whatever the first matches.

A relatively simple (and too permissive) regex would be:

if ($qs =~ /^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*(\/\d+)?$/) { # do stuff with $qs }