0

I have used the following regex to get the data between the tag below (Volkswagen Eos) from a page. The page I am working on, it has different id for every item (4222620).

preg_match_all('!<span class="p_t"><strong>(.*?)</strong></span>!is', $str2b, $names);

the HTML code is below.

    <div>
      <span id="clsfd_title_4222620" class="p_t" id=""><strong>Volkswagen Eos</strong></span>
    </div>

Unfortunately I can not get the data. Is this because I didn't use the whole tag? If so, what is a regex I can use to get the data of any written ID?

Thank you

EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179

1 Answers1

0

If you do not mind about id value and id value does not have space or tabs, I think, the regex like this can be used:

<span (?:id="\S*" )?class="p_t"(?: id="\S*")><strong>(.*?)</strong></span>
VladimirM
  • 817
  • 5
  • 7