php - Get dom elements with particular string in the attribute -
i trying use domxpath
find attributes contain value {{xxx}}
(where xxx
can anything).
this using, isn't working. nor getting errors saying invalid query.
foreach($docx->query('//*[*="*{{*}}*"]') $node){ // stuff }
i trying find items might (but not limited to) following:
<a href="/path/{{value}}">link</a> <p class="{{classes}}"></p>
is there way items using domxpath::query()
?
xpath 2.0 has matches()
function lets use regular expressions. in 1.0 though, domxpath
uses, best bet like:
//*[contains(@*,"{{") , contains(@*,"}}")]
note still match cases }}
precedes {{
or there's nothing between two, you'd want double-check results once them.
Comments
Post a Comment