I am trying to craft a regexp to validate iSCSI qualified names. An example of a qualified name is iqn.2011-08.com.example:storage
This is example is minimal, I have seen other examples that are more extended.
So far what I have to validate off of it this:
print "Enter a new target name: ";
my $target_name = <STDIN>;
chomp $target_name;
if ($target_name =~ /^iqn\.\d{4}-\d{2}/xmi) {
print GREEN . "Target name is valid!" . RESET . "\n";
} else {
print RED . "Target name is not valid!" . RESET . "\n";
}
How can I extend that to work with rest up to the :
I am not going to parse after the :
becuase it is a description tag.
Is there a limit to how big a domain name can be?