Re: regex to match any url
- From: "A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 14 Feb 2006 21:23:28 GMT
nodiseos@xxxxxxxxx wrote in news:1139950940.817938.158230
@g14g2000cwa.googlegroups.com:
I am struggling way too much with this. Does someone have a regexthat
will match any url-ish string like. Not worried about mail links.
http://sd.org
www.dssd.com
ibm.mil
https://sdsdsd.jobs
xyz.travel
Please show what you have tried and what has not worked so that we can
help you with what you don't know rather than acting as a "write-my-
code-for-me" service.
#!/usr/bin/perl
use strict;
use warnings;
while ( <DATA> ) {
print if m{ \A (?: https?:// )? \w+ (?: \. \w+)+ \n \z }x;
}
__DATA__
http://sd.org
www.dssd.com
ibm.mil
https://sdsdsd.jobs
xyz.travel
D:\Home\asu1\UseNet\clpmisc> u
http://sd.org
www.dssd.com
ibm.mil
https://sdsdsd.jobs
xyz.travel
--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
.
- Follow-Ups:
- Re: regex to match any url
- From: axel
- Re: regex to match any url
- References:
- regex to match any url
- From: nodiseos
- regex to match any url
- Prev by Date: regex to match any url
- Next by Date: Re: regex to match any url
- Previous by thread: regex to match any url
- Next by thread: Re: regex to match any url
- Index(es):
Relevant Pages
|