See also:
https://github.com/astrohart/MyJunkSolution[
^]
I am trying to find a Regular Expression to dig into the content of a .sln file and do a "sort of exact match" on project names, their containing folders, and any associated files, but JUST of the target project.
The solution also contains other projects whose names "contain" the name of the target project, but I don't want those. I want to find all occurrences of the name of JUST the target project.
Suppose I have the following .sln file:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution", "MyJunkSolution\MyJunkSolution.csproj", "{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution.Displayers.Interfaces", "MyJunkSolution.Displayers.Interfaces\MyJunkSolution.Displayers.Interfaces.csproj", "{84C1F71A-AAA4-4A08-9728-19E710965E4D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution.Displayers", "MyJunkSolution.Displayers\MyJunkSolution.Displayers.csproj", "{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution.Displayers.Factories", "MyJunkSolution.Displayers.Factories\MyJunkSolution.Displayers.Factories.csproj", "{782E7FBC-9EB8-4944-8441-679C07E43DB7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution.Waiters.Interfaces", "MyJunkSolution.Waiters.Interfaces\MyJunkSolution.Waiters.Interfaces.csproj", "{F9644AAA-150F-474E-8CD4-C99AEAF136E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution.Waiters", "MyJunkSolution.Waiters\MyJunkSolution.Waiters.csproj", "{646DC003-0434-44C2-8E83-35982F901A96}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyJunkSolution.Waiters.Factories", "MyJunkSolution.Waiters.Factories\MyJunkSolution.Waiters.Factories.csproj", "{95088FA2-D4F5-4353-87C6-F20222DD1851}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Foo", "Foo\Foo.csproj", "{CEE60A21-806E-453D-81F6-A858AF2A22D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Debug|Any CPU.ActiveCfg = Debug|x86
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Debug|x64.ActiveCfg = Debug|x64
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Debug|x64.Build.0 = Debug|x64
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Debug|x86.ActiveCfg = Debug|x86
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Debug|x86.Build.0 = Debug|x86
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Release|Any CPU.ActiveCfg = Release|x86
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Release|x64.ActiveCfg = Release|x64
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Release|x64.Build.0 = Release|x64
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Release|x86.ActiveCfg = Release|x86
{F2DE8BB4-FD3A-421C-A2BE-754929A4E757}.Release|x86.Build.0 = Release|x86
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Debug|Any CPU.ActiveCfg = Debug|x86
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Debug|x64.ActiveCfg = Debug|x64
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Debug|x64.Build.0 = Debug|x64
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Debug|x86.ActiveCfg = Debug|x86
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Debug|x86.Build.0 = Debug|x86
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Release|Any CPU.ActiveCfg = Release|x86
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Release|x64.ActiveCfg = Release|x64
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Release|x64.Build.0 = Release|x64
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Release|x86.ActiveCfg = Release|x86
{84C1F71A-AAA4-4A08-9728-19E710965E4D}.Release|x86.Build.0 = Release|x86
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Debug|Any CPU.ActiveCfg = Debug|x86
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Debug|x64.ActiveCfg = Debug|x64
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Debug|x64.Build.0 = Debug|x64
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Debug|x86.ActiveCfg = Debug|x86
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Debug|x86.Build.0 = Debug|x86
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Release|Any CPU.ActiveCfg = Release|x86
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Release|x64.ActiveCfg = Release|x64
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Release|x64.Build.0 = Release|x64
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Release|x86.ActiveCfg = Release|x86
{B5100EA8-BE29-49CF-A08F-823D7F4DFFC5}.Release|x86.Build.0 = Release|x86
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Debug|Any CPU.ActiveCfg = Debug|x86
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Debug|x64.ActiveCfg = Debug|x64
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Debug|x64.Build.0 = Debug|x64
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Debug|x86.ActiveCfg = Debug|x86
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Debug|x86.Build.0 = Debug|x86
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Release|Any CPU.ActiveCfg = Release|x86
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Release|x64.ActiveCfg = Release|x64
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Release|x64.Build.0 = Release|x64
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Release|x86.ActiveCfg = Release|x86
{782E7FBC-9EB8-4944-8441-679C07E43DB7}.Release|x86.Build.0 = Release|x86
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Debug|Any CPU.ActiveCfg = Debug|x86
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Debug|x64.ActiveCfg = Debug|x64
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Debug|x64.Build.0 = Debug|x64
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Debug|x86.ActiveCfg = Debug|x86
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Debug|x86.Build.0 = Debug|x86
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Release|Any CPU.ActiveCfg = Release|x86
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Release|x64.ActiveCfg = Release|x64
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Release|x64.Build.0 = Release|x64
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Release|x86.ActiveCfg = Release|x86
{F9644AAA-150F-474E-8CD4-C99AEAF136E1}.Release|x86.Build.0 = Release|x86
{646DC003-0434-44C2-8E83-35982F901A96}.Debug|Any CPU.ActiveCfg = Debug|x86
{646DC003-0434-44C2-8E83-35982F901A96}.Debug|x64.ActiveCfg = Debug|x64
{646DC003-0434-44C2-8E83-35982F901A96}.Debug|x64.Build.0 = Debug|x64
{646DC003-0434-44C2-8E83-35982F901A96}.Debug|x86.ActiveCfg = Debug|x86
{646DC003-0434-44C2-8E83-35982F901A96}.Debug|x86.Build.0 = Debug|x86
{646DC003-0434-44C2-8E83-35982F901A96}.Release|Any CPU.ActiveCfg = Release|x86
{646DC003-0434-44C2-8E83-35982F901A96}.Release|x64.ActiveCfg = Release|x64
{646DC003-0434-44C2-8E83-35982F901A96}.Release|x64.Build.0 = Release|x64
{646DC003-0434-44C2-8E83-35982F901A96}.Release|x86.ActiveCfg = Release|x86
{646DC003-0434-44C2-8E83-35982F901A96}.Release|x86.Build.0 = Release|x86
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Debug|Any CPU.ActiveCfg = Debug|x86
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Debug|x64.ActiveCfg = Debug|x64
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Debug|x64.Build.0 = Debug|x64
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Debug|x86.ActiveCfg = Debug|x86
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Debug|x86.Build.0 = Debug|x86
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Release|Any CPU.ActiveCfg = Release|x86
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Release|x64.ActiveCfg = Release|x64
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Release|x64.Build.0 = Release|x64
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Release|x86.ActiveCfg = Release|x86
{95088FA2-D4F5-4353-87C6-F20222DD1851}.Release|x86.Build.0 = Release|x86
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Debug|Any CPU.ActiveCfg = Debug|x86
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Debug|x64.ActiveCfg = Debug|x64
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Debug|x64.Build.0 = Debug|x64
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Debug|x86.ActiveCfg = Debug|x86
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Debug|x86.Build.0 = Debug|x86
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Release|Any CPU.ActiveCfg = Release|x86
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Release|x64.ActiveCfg = Release|x64
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Release|x64.Build.0 = Release|x64
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Release|x86.ActiveCfg = Release|x86
{CEE60A21-806E-453D-81F6-A858AF2A22D3}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {25CAA92D-1AF0-4988-9AA1-E850D91203CA}
EndGlobalSection
EndGlobal
I am trying to match only the following text with a regex:
MyJunkSolution.Displayers
Basically, I am wanting to do a regex-replace operation but only on the entry for the
MyJunkSolution.Displayers
project itself. But, for that .sln file entry line, I want to find every occurrence of
MyJunkSolution.Displayers
.
I do not want to match
Foo
Foo.csproj
.someDotfile
MyJunkSolution.Displayers.Interfaces
MyJunkSolution.Displayers.Interfaces.csproj
MyJunkSolution.Displayers.Models
MyJunkSolution.Displayers.Models.csproj
etc.
What I have tried:
I have tried using the Regular Expression:
^(MyJunkSolution\.Displayers)[a-z.]*$
According to my knowledge of regexes -- which is extremely limited, I thought this would work. However, it returns zero matches. I am stumped.
Next, I tried
/MyJunkSolution\.Displayers[a-z\.]*[^A-Z\.]/gm
I got three matches:
- MyJunkSolution.Displayers"
- MyJunkSolution.Displayers\
- MyJunkSolution.Displayers.csproj"
This is almost what I want. I have tested this with the website regex101.com, and the matches are in the exact spots I expect. Now, if only I could get rid of the trailing quotes and backslash characters.
Just to reiterate, I want to dig through the
.sln
file whose text is above, and just get the matches of
MyJunkSolution.Displayers
MyJunkSolution.Displayers.csproj
MyJunkSolution.Displayers.anyOtherFileExtensionCapitalizedLikeThisOrNot
Thanks in advance for any assistance.