PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Dec 07, 2019 5:01 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Regex challenge
PostPosted: Tue Jan 31, 2012 9:07 pm 
Offline
Forum Newbie

Joined: Tue Jan 31, 2012 8:50 pm
Posts: 2
Hello,

Can anyone do this regex task?
First here is the string:



<P ALIGN="LEFT">
<FONT FACE="Times New Roman" style="font-size:2px" COLOR="#000000" LETTERSPACING="0" KERNING="0">
<A HREF="javascript: lightbox('');">
<IMG SRC="images/pages/abandoned_beauty.jpg" ID="$img3" ALIGN="left" VSPACE="8" HSPACE="8">
<IMG SRC="images/pages/abandoned_beauty.jpg" ID="$img4" ALIGN="left" VSPACE="8" HSPACE="8">
</A>
</FONT>
</P>


<P ALIGN="LEFT">
<FONT FACE="Times New Roman" style="font-size:12px" COLOR="#000000" LETTERSPACING="0" KERNING="0">
</FONT>
</P>

<P ALIGN="LEFT">
<FONT FACE="Times New Roman" style="font-size:2px" COLOR="#000000" LETTERSPACING="0" KERNING="0">
<A HREF="http://nekisajt.com" TARGET="_blank">
<IMG SRC="images/pages/close_to_heart.jpg" ID="$img5" ALIGN="left" VSPACE="8" HSPACE="8">
</A>
</FONT>
</P>



<P ALIGN="LEFT">
<FONT FACE="Times New Roman" style="font-size:12px" COLOR="#000000" LETTERSPACING="0" KERNING="0">
</FONT>
</P>

<P ALIGN="LEFT">
<FONT FACE="Times New Roman" style="font-size:2px" COLOR="#000000" LETTERSPACING="0" KERNING="0">
<A HREF="javascript: lightbox('');">
<IMG SRC="images/pages/fresh_picked.jpg" ID="$img6" ALIGN="left" VSPACE="8" HSPACE="8">

</A>
</FONT>
</P>



Second, I need to extract 'SRC' value from 'IMG' tag and place it between single quotes in lightbox('') which is inside 'HREF' tag of it's parent 'A' tag (and only it's parent 'A' tag - so this is the rule).

Third, source string is case sensitive and must be exactly like it is placed here with all new lines and silly upper case HTML tags :)

Any idea would be appreciated.
Sorry, but I needed to just paste the target string here without put it in the BBCode Text tag because some characters were changed in BBCode.

Zoran


Top
 Profile  
 
 Post subject: Re: Regex challenge
PostPosted: Tue Jan 31, 2012 10:11 pm 
Offline
Forum Newbie

Joined: Fri Jan 06, 2012 2:43 am
Posts: 9


Top
 Profile  
 
 Post subject: Re: Regex challenge
PostPosted: Tue Jan 31, 2012 11:51 pm 
Offline
Forum Newbie

Joined: Tue Jan 31, 2012 8:50 pm
Posts: 2
This should do it. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group