I’m trying to capture the following pattern “everything except data-extra”
Here is the search string :
<li data-extra="star" class = "result">a</li>
<li class = "result">b</li>
<li class = "result">c</li>
<li data-extra="star" class = "result">d</li>
<li class = "result">e</li>
And I would like to match only b, c and e (those without data-extra)
I’ve done something like this
<li(?!(data\-extra))class="result"(.*?)>
but this doesn’t work (0 result with php preg_match_all)
Use
xpath_match_allandIf you want to explicitly include the class as well, change the XPath to
The
$resultsvariable will contain the innerHTML and outerHTML of the found nodes.