Jump to content
UBot Underground

Scrape a string between two strings


Recommended Posts

I am trying to scrape data from an html page (code sample below).

The data I want to scrape is between two td tags:

Starting at : <td align="center" bgcolor="#F3F7F8" >

Closing at </td>

I need to get the data between those tags. After trying to learn rejex for two days, I didn't succeed to do it.

Anyone has any suggestion?

 

Thanks

 



         <td align="center" bgcolor="#F3F7F8" >		
           <b><font face="Arial" size="2">
           <img border =0 name="DDD" src="../Images/esh.gif" 
           style="cursor: hand;"
           onClick="MyPopUpWinJV('פרטינעל מומחיות  ד\'ר ×Âדלמן בוריס','18204','www.old.health.gov.il');"
           
           >
           </font></b>
		</td>

         <td align="right" bgcolor="#F3F7F8" width="105"><font face="Arial" size="2" color="#0000FF">בתוקף       </font></td>


         <td align="right" bgcolor="#F3F7F8" width="80"><font face="Arial" size="2" color="#0000FF">רשיון קבוע                   </font></td>

         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">03/05/1971</font></td>
         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">תל ×Âביב - יפו</font></td>
         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">1-8755</font></td>
         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">בוריס</font></td>
         <td align="right" dir=rtl bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">×Âדלמן</font></td>
         <td bgcolor="#369CCD" align="center"><font color="#FFFFFF" face="Arial" size="1">55</font></td>
       </tr>

       <tr>

<td align="center" bgcolor="#F3F7F8" >
</td>

         <td align="right" bgcolor="#F3F7F8" width="105"><font face="Arial" size="2" color="#0000FF">בתוקף       </font></td>


         <td align="right" bgcolor="#F3F7F8" width="80"><font face="Arial" size="2" color="#0000FF">רשיון קבוע                   </font></td>

         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">30/03/2003</font></td>
         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">תל ×Âביב - יפו</font></td>
         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">1-34977</font></td>
         <td align="right" bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">×Âלי×â€Ã—•</font></td>
         <td align="right" dir=rtl bgcolor="#F3F7F8"><font face="Arial" size="2" color="#0000FF">×Âדלמן</font></td>
         <td bgcolor="#369CCD" align="center"><font color="#FFFFFF" face="Arial" size="1">56</font></td>
       </tr>

       <tr>


         <td align="center" bgcolor="#F3F7F8" >		
           <b><font face="Arial" size="2">
           <img border =0 name="DDD" src="../Images/esh.gif" 
           style="cursor: hand;"
           onClick="MyPopUpWinJV('פרטינעל מומחיות  ד\'ר ×Âדלמן ×Âלי×Âס גברי×Âל ×Âדרי×Âן','86478','www.old.health.gov.il');"
           
           >
           </font></b>
		</td>

Link to post
Share on other sites

Hi,

 

I know it is not regex.

 

This should work.

select-td-data-share.ubot

 

Kevin

 

Thank you Kevin for your replay, the code you wrote is scraping only part of the code between the tags.

and unfortunately its not the part i need (i need the onclick code in brackets, or blank if nothing in this specific cell).

MyPopUpWinJV('פרטינעל מומחיות  ד\'ר ×Âדלמן בוריס','18204','www.old.health.gov.il')

it seems like ubot function (page scrape) has problem scraping this code because all the special characters in it.

thats why i thought regex is the solution (hope i am wrong, am i?).

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...