PHP preg匹配错误捕获

I want to capture <div class='troll'><goodTag/>trololoQWE</div> (1)

and <div class='troll'>trololo123</div> (2)

and <div class='troll'>besttrololo123</div> (3)

but ignore <div class='troll'><badTag/>trololoASD</div> (4)

I tried this regexp: /<div class='troll'>([^(<badTag\/>)].*?)<\/div>/

but then I can capture only (2) :(

How to correctly ignore long text from first position of capture group ??

Edit: I want catch all content of this div, but ignore if first item is <badTag>

You should use the following regex:

/(<div class='troll'>(?!<badTag\/>).*<\/div>)/

Demo

Try this one:

/<div class='troll'>((?!<badTag\/>).*)<\/div>/

Tested here:

http://www.phpliveregex.com/p/69Y