0

I have below table structure,

I want to fetch all values from 3rd columns that is Original Part Number.

Please check attach screenshot.

<table class="stripeMe">
  <tbody>
    <tr>
      <th>Image</th>
      <th>Part#</th>
      <th>Original#</th>
      <th>Description</th>
    </tr>
    <tr class="alt">
      <td>
        <a href="/item/8438657/High_Capacity/AC-C27/18_TO_20_VOLT_65_WATT_AC_ADAPT"><img width="75" height="75" title="AM11X-2719 18 TO 20 Volt 65 Watt AC Adapter" src="/shop/images/image.php?img=BAT\8438657.jpg&amp;thumbnail=Y"></a>
      </td>
      <td><a title="AM11X-2719 18 TO 20 Volt 65 Watt AC Adapter" href="/item/8438657/High_Capacity/AC-C27/18_TO_20_VOLT_65_WATT_AC_ADAPT">AC-C27</a></td>
      <td>TR82J</td>
      <td>18 TO 20 Volt 65 Watt AC Adapter</td>
    </tr>
    <tr class="">
      <td>
        <a href="/item/10242499/High_Capacity/DRAC90B/DURACELL_90W_19V_UNIVERSAL_NOT"><img width="75" height="75" title="AM11X-2719 Duracell 90W 19V Universal Notebook AC Adapter" src="/shop/images/no_picture_thumb.jpg"></a>
      </td>
      <td><a title="AM11X-2719 Duracell 90W 19V Universal Notebook AC Adapter" href="/item/10242499/High_Capacity/DRAC90B/DURACELL_90W_19V_UNIVERSAL_NOT">DRAC90B</a></td>
      <td>331-0536</td>
      <td>Duracell 90W 19V Universal Notebook AC Adapter</td>
    </tr>
  </tbody>
</table>

enter image description here

Monah
  • 6,714
  • 6
  • 22
  • 52
John
  • 61
  • 8
  • 1
    Use PHP Simple DOM Parser http://simplehtmldom.sourceforge.net/ – Sasikumar Sep 28 '16 at 04:09
  • can you please give example – John Sep 28 '16 at 04:16
  • Is the html table a string are is it taken from a website. The Simple DOM Parser manual will help with examples. http://simplehtmldom.sourceforge.net/manual.htm there is a clear way of doing it. – Sasikumar Sep 28 '16 at 04:18
  • Possible duplicate of [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) – cske Sep 28 '16 at 06:34

1 Answers1

0

You can use this regular expression:

<td>[A-Z0-9-]+<\/td>

demo

Mandatory for reading: RegEx match open tags except XHTML self-contained tags

Community
  • 1
  • 1