For the given xml formatted string
<ItemGroup>
<PackageReference Include="Bond.CSharp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bond.CSharp" />
</ItemGroup>
I am attempting to capture
<ItemGroup>
<PackageReference
using the following Regex:
<ItemGroup>\s*<PackageReference
How can I limit the result to just the first match and not get both ItemGroups?
I am using C# flavored regex
I tried using
(<ItemGroup>\s*<PackageReference)+?
and
<ItemGroup>\s*<PackageReference{0,1}
but neither approach worked for me