In PHP how to limit search with regex to a div class html?

0

In php, how to mount a regex (to use with preg_match_all ) the link in href and title between >(.*?)< ONLY in class "container" (15 occurrences). In the source, without the limitation to a class are 60 occurrences found. I know that using Regex with html is not recommended, I happen to think regex more practical to mount. I read in the stackoverflow in English a suggestion to capture the block inside the tag, I tried to replicate separating link and title, but it did not work.

<div class="container">
<li class="nav-item cat-item-19"><a href="http://www.exemplo.com/1">teste</a>
</div>
    
asked by anonymous 13.10.2017 / 18:42

0 answers