Konrad,

For starters, it all depends on how much error checking you want. If your list only contains VALID urls, then there won't be any problem with the following regex. If each entry of your URL list is in an array, then do the following:

foreach(@array)
{
## Email me for explaination of Regex
if($_ =~ m/http:\/\/([\w\d]+(-+[\w\d]+)?\.)+[\w]{2,3}(\/.*)?/)
{
print "$_\n";
}
}

This will only print out internet urls like:

http://www.h-p.com.au/
http://links.com/
http://w.w.w.w.w.com/

NOT intranet urls like:

http://host/

The above regex may be a bit overkill because I put some URL syntax checking stuff into it protect against matching INVALID URLS like:

http://www.-domain.com/
http://.domain.com/
http://./
http://-/
http://.dd/

Otherwise, that should do it for you. Let me know if you have any problems.


John Von Essen
[EMAIL PROTECTED]
www.essenz.com


On Sunday, December 1, 2002, at 08:29 PM, Schulz, Konrad wrote:


Hi all,

I know that that might not really fit into this mailing list but I am
looking for an regular expression that filters out of a bunch of URLs all
URL that are situated on the Internet and not on the Intranet!

So I might have something like this:
http://localhost/index.html
http://localhost5/menu.asp
http://www.hp.com.au/
http://links.links.com/
..
..
..
and so on. I would like to get all the URLs which are likely to be on the
Internet seperated from the URLs leading to a site of the Intranet!

Cheers
Konrad



Australia Post is committed to providing our customers with excellent service. If we can assist you in any way please either telephone 13 13 18 or visit our website www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential information intended for the use of the addressee. The confidentiality and/or privilege in this e-mail is not waived, lost or destroyed if it has been transmitted to you in error. If you have received this e-mail in error you must (a) not disseminate, copy or take any action in reliance on it; (b) please notify Australia Post immediately by return e-mail to the sender; and (c) please delete the original e-mail.




Reply via email to