Friday, May 21, 2010

Perl expression to extract URL from text?

I'm looking for a perl expression to extract urls from text. The more flexible it is the better.





For example, it would be nice if it could find all of these:


http://www.yahoo.com


yahoo.com


www.yahoo.com/mypage/





Thanks so much for the help! I will be using this in php if it makes any difference.

Perl expression to extract URL from text?
use Regexp::Common;


while (%26lt;%26gt;) {


while (m/$RE{URI}{-keep}/g) {


print "found a URI =$1=\n";


}


}

flower arranging

No comments:

Post a Comment