Q:

Regex match tags with specific text within

I have an XML document where I am trying to match the full tag if it contains sometextv2 within. Here's the sample dataset I am working with:
<mm_reportitem>
    <mm_file>file.cfm</mm_file>
    <mm_displaystr><![CDATA[ <cfinvoke component="/sometextv2" ]]></mm_displaystr>
</mm_reportitem>
<mm_reportitem>
    <mm_file>file.cfm</mm_file>
    <mm_displaystr><![CDATA[ <cfinvoke component = "/sometext" ]]></mm_displaystr>
</mm_reportitem>
<mm_reportitem>
    <mm_file>file.cfm</mm_file>
    <mm_displaystr><![CDATA[ <cfinvoke component="sometextv2" ]]></mm_displaystr>
</mm_reportitem>

I'm working with the following that I put together from a couple different sources:
<mm_reportitem[^>]*>([\s\S]*?).*sometextv2.*([\s\S]*?)<\/mm_reportitem>

This is matching the full tag I am wanting. However, this appears to be matching both sometext and sometextv2.
What am I missing so that only sometextv2 gets matched?

A:

Try with:
<mm_reportitem>[\s\S]{10,200}sometextv2\"[\s\S]*?<\/mm_reportitem>

I just add the {10,150} to avoid more than one mm_reportitem in one result. I think it's a problem with regex too "greedy" in this strange case...

