if (m/^(((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu +|gov|m +il|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\ +. +\,\;\?\'\\\+&%\$#\=~_\-]+))*$/){ my($host,$path) = ($4,$5); print "$host => $path\n"; }
Some thoughts:
I can identify parts of this regex, but what, for instance, is (www.|[a-zA-Z].) ('www' followed by any character, or else a single alpha character followed by any character) supposed to match in a URL? (This is immediately followed by [a-zA-Z0-9\-\.]+ \. without any delimiter.)if (m{ ^ ( # open capturing group 1 (was unbalanced) ((ht|f)tp(s?) \: //)? # removed close paren after (s?) (www.|[a-zA-Z].) [a-zA-Z0-9\-\.]+ \. (com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk) (\:[0-9]+)* (/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))* ) $ # (maybe?) added for balance: close capture group 1 }x ) { my($host,$path) = ($4,$5); print "$host => $path\n"; }
Give a man a fish: <%-{-{-{-<
In reply to Re^5: Grab input from the user and Open the file
by AnomalousMonk
in thread Grab input from the user and Open the file
by valerydolce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |