0

Sorry if the title of this question is poor. Allow me to explain myself (but do bear in mind that I am new to programming, and even newer to StackOverflow, both of which I am loving).

Basically I am scraping data from a particular cell in an HTML table on Site X. The name of the particular cell would be something like id="xyz/part_to_check/". In other words, I need to have simple_html_dom only pull data from the cell that has the class id that ENDS with a particular name, while avoiding other cells who's name might all begin with the same thing.

When I tell simple_html_dom to check for a cell, it would be something like

$html->find("a[href="name of cell goes here"]");

How can I have the "name of cell" only be for cells who's name ENDS with what I want to?

I hope I was somewhat clear here. I do apologize if I wasn't. Again, new to this whole thing. Any help is greatly appreciated.

devirkahan
  • 430
  • 1
  • 8
  • 22

1 Answers1

1

Add a $ before the = sign:

$html->find('a[href$="someValue"]');
//                 ^ This indicates that the href should END with that string.
Joseph Silber
  • 214,931
  • 59
  • 362
  • 292