Using URI is most likely more reliable than rolling your own regex, but in the interests of improving your knowledge of regexen the following may be of help:
use strict; use warnings; for (qw(http://www.url.com http://www.url.com/ http://www.url.com/cgi. +pl?x=y)) { my $displayed_link = $_; $displayed_link =~ s!^.*?(\w*://[^/]+/?).*!$1!; print $displayed_link, "\n"; }
prints:
http://www.url.com http://www.url.com/ http://www.url.com/
In reply to Re: Regex Question
by GrandFather
in thread Regex Question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |