I have an xml file and I need to read only a particular substring from the main string. The xml file looks like below:
<?xml version="1.0" encoding="utf-8"?>
<Report Version="10.0">
<Entities>
<Entity Name="\\sharing\Data\SB\**appname**\wcf\Utilitysvc\bin\svcUtility.Host.dll">
<Mods>
<Mod Name="svcUtility.Host.dll" AssemblyVersion="1.0.2000.001">
<Fields>
<Field Name="TIndex" Value="100" />
<Field Name="Vindex" Value="200" />
</Fields>
</Mod>
</Mods>
</Entity>
</Entities>
</Report>
The main string in this xml is -
<Entity Name="\\sharing\Data\SB\**appname**\wcf\Utilitysvc\bin\svcUtility.Host.dll">
And I need to print only the "appname" from it.
What condition logic can I use to print this using regex in powershell? And it need not be \wcf after the appname always.. it can be anything based on the dll path. For Eg, it can be like:
<Entity Name="\\sharing\Data\*SB*\**appname**\**Web**\Utilitysvc\bin\svcUtility.Host.dll">
or
<Entity Name="\\sharing\Data\*SB*\*DEVCS*\**appname**\**junk**\Utilitysvc\bin\svcUtility.Host.dll">
Can I have a generic select -string way? need to test this as well..
Thanks,
Ashish