Help for this page

Select Code to Download


  1. or download this
    if ($domain =~ /[A-Z0-9]+[A-Z0-9-]+[A-Z0-9]/i) {
      # do A
    } else {
      # do B
    }
    
  2. or download this
    # /[A-Z0-9]+[A-Z0-9-]+[A-Z0-9]/i matches
    someDomain
    someDomain..
    ..someDomain..
    _!@#!@#!@#01a!@#$
    # and so on
    
  3. or download this
    if ($domain =~ /([A-Z0-9]+[A-Z0-9-]+[A-Z0-9])/i) {
      # $1 contains what is in the first pair of parentheses
      print "$1 matched\n\n"; 
    } else {
      print "$domain did not match\n\n";
    }