Advertisement

04.22.2008 at 07:20PM PDT, ID: 23345286
[x]
Attachment Details

regex image link extractor

Asked by joshkrak in Regular Expressions

Tags: regex regular expression

Need a regex that will verify/extract a image url from a submitted link.
It could be in the form of
http://www.domain.com/subfolder/ ... /image.jpg

or could be embed text from another like:
<a href="http://icanhascheezburger.com/2008/04/22/funny-pictures-just-for-the-attention/"><img class="alignnone size-full wp-image-51237" style="word-spacing:897247px;font-size:897247px;" src="http://icanhascheezburger.wordpress.com/files/2008/04/funny-pictures-emo-goat-in-tree.jpg" alt="humorous pictures" width="500" height="336" /></a><br />see more <a href="http://icanhascheezburger.com">crazy cat pics</a>

For the above text, it would extract "http://icanhascheezburger.wordpress.com/files/2008/04/funny-pictures-emo-goat-in-tree.jpg"

I've googled forever and all I could find are ones that either match a href="" or src="" or a straight URL like http://domain.com/ ... /image.jpg

Can match on the image types: jpg, bmp, gif, png


Thanks for the help!Start Free Trial
 
Loading Advertisement...
 
[+][-]04.22.2008 at 07:46PM PDT, ID: 21417433

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 08:14PM PDT, ID: 21417519

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 08:20PM PDT, ID: 21417543

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Regular Expressions
Tags: regex regular expression
Sign Up Now!
Solution Provided By: Hube02
Participating Experts: 1
Solution Grade: B
 
 
[+][-]04.22.2008 at 08:40PM PDT, ID: 21417626

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 08:43PM PDT, ID: 21417633

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 12:22AM PDT, ID: 21418372

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628