在包含一些文本的节点上使用正则表达式进行xpath查询

I want to get nodes which contain this text "$$$EXM_TAB$$$"

$exampleNodes = $XPath->query('//*[contains(text(),"$$$EXM_TAB$$$")]');
foreach($exampleNodes as $exampleNode){
        $exampleNode->parentNode->removeChild($exampleNode);
    }

Problem is I am not getting any node.. can anyone help please.. Thank you

You need to be sure that you are properly initializing $XPath and it contains your document or it's part. According the xpath statement - it looks absolutely fine. So, I would suggest you to debug and to see your $XPath variable. It might be something like this:

$doc->Load('data.xml');

$XPath = new DOMXPath($doc);