0

I have the next elements:

    <Reference Include="Microsoft.AspNetCore.Sockets.Common.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\LIB.XPTO.1.18.524.20\lib\net45\Microsoft.AspNetCore.Sockets.Common.Http.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
      <HintPath>..\..\packages\LIB.XPTO.1.0.1.2\lib\net45\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
    </Reference>

I want get all reference elements that contains the element HintPath or any other element, that is, I wan't that the <Reference Include="Microsoft.CSharp" /> don't be geted by my regex.

I'm using the partern /<Reference[\s\S]*?<\/Reference> but this can't exclude the <Reference Include="Microsoft.CSharp" />.

How to do that?

Edit

How result I want this on each match:

1:

<Reference Include="Microsoft.AspNetCore.Sockets.Common.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
          <HintPath>..\..\packages\LIB.XPTO.1.18.524.20\lib\net45\Microsoft.AspNetCore.Sockets.Common.Http.dll</HintPath>
        </Reference>

2:

<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
          <HintPath>..\..\packages\LIB.XPTO.1.18.524.20\lib\net45\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
        </Reference>
Community
  • 1
  • 1
Renatto Machado
  • 1,534
  • 2
  • 16
  • 33

1 Answers1

0

This should do the trick. Here's a demo.

<\/?Reference.*\/?>
Boris
  • 805
  • 1
  • 8
  • 20