tags:

views:

56

answers:

3

Hello all

    <div id="a">
       <div id="b">
        Foo
      </div>
       <div id="m">
       Bar
      </div>
     </div>
     <div id="c">
       Bar
      </div>

I want find all object in id="a" and out put is

 <div id="a">
   <div id="b">
    Foo
  </div>
   <div id="m">
   Bar
  </div>
 </div>

Geat thanks.

A: 

Seems the community has responded to this before as a bad idea. Looks to be other, better ways. Jquery, HTML parsers, etc.

A search on regex in SO

StackOverflow Thoughts on Regex and HTML

PHP/HTML Regex

Tommy
A: 

SimpleHTMLDom is memory consuming solution. It may cause memory leaks. I recommend using DOMDocument and DOMXPath. Then you can fetch all div#a by this way:

$xpath->query('//div[@id = "a"]')
Radek Šimko
A: 

and one solution???? please contact me when have a solution

silatica