using System.Text.RegularExpressions;
public static string content;
public static void Main()
ComponentJsonPathFinder();
ComponentAPIFolderFinder();
public static void IncludeFinder()
var regex = @"{%\s?include\s+(['""])([^{}]*?)\1[\s,]?.*?[-]?%}";
_Finder("Include", regex, content);
public static void ComponentLayoutFinder()
var regex = @"{%\s?component\s+(?!.*?type\s*?:\s*?['""]module['""][\s,]?).*?layout\s*?:\s*?(['""])([^{}]*?)\1[\s,]?.*?[-]?%}";
_Finder("ComponentLayout", regex, content);
public static void ComponentJsonPathFinder()
var regex = @"{%\s?component\s+(?=.*?source_type\s*?:\s*?['""]path['""][\s,]?).*?source\s*?:\s*?(['""])([^{}]*?)\1[\s,]?.*?[-]?%}";
_Finder("ComponentJsonPath", regex, content);
public static void ComponentAPIFolderFinder()
var regex = @"{%\s?component\s+(?=.*?type\s*?:\s*?['""]api['""][\s,]?).*?folder\s*?:\s*?(['""])([^{}]*?)\1[\s,]?.*?[-]?%}";
_Finder("ComponentAPIFolderPath", regex, content);
public static void ScriptsFinder()
var regex = @"<script\s.*?src=(['""]?)(.*?)\1(\s|>|\/>)";
_Finder("Scripts", regex, content);
public static void CSSFinder()
var regex = @"<link\s.*?href=(['""]?)(.*?)\1(\s|>|\/>)";
_Finder("Styles", regex, content);
public static void ImageFinder()
var regex = @"<img\s.*?src=(['""]?)(.*?)\1(\s|>|\/>)";
_Finder("Image", regex, content);
private static void _Finder(string entityName, string regex, string content)
Console.Write(entityName + " Path Finder\r\n\r\n");
var matches = Regex.Matches(content, regex, RegexOptions.IgnoreCase);
foreach (Match match in matches)
catch (RegexMatchTimeoutException) {}
Console.Write("\r\n--------------------------------\r\n\r\n");
private static void _GetContent()
content = @"<script type=""text/javascript"" src=""/My Folder/MyJS_%20File1.js""></script>
<script type=""text/javascript"" src='/My Folder/MyJS_%20File2.js'></script>
<script type=""text/javascript"" src=/MyFolder/MyJS_%20File3.js></script>
<script type=""text/javascript"" src=/MyFolder/MyJS_%20File4.js/>
<script type=""text/javascript"" src=/MyFolder/MyJS_%20File5.js class=""dd""></script>
<img src=""/My Folder/MyIMG_%20File1.jpg"">
<img id=""textdavascript"" src='/My Folder/MyIMG_%20File2.jpg'>
<img id=""texsjavascript"" src=/MyFolder/MyIMG_%20File3.jpg>
<img id=""texsjavascript"" src=/MyFolder/MyIMG_%20File4.png/>
<img id=""textgjavascript"" src=/MyFolder/MyIMG_%20File5.webp class=""dd"">
<link href=""/My Folder/Mycss_%20File1.css"">
<link media=""all"" href='/My Folder/Mycss_%20File2.css'>
<link media=""all"" href=/MyFolder/Mycss_%20File3.css>
<link media=""all"" href=/MyFolder/Mycss_%20File4.css/>
<link media=""all"" href=/MyFolder/Mycss_%20File5.css class=""dd"">
{% include ""/my IncludeFolder/My Include FilePath1.inc"" %}
{% include ""/my IncludeFolder/My Include FilePath2.inc""%}
{% include ""/my IncludeFolder/My Include FilePath3.inc""-%}
{% include ""/shouldNotBeFound IncludeFolder/{{someVar}}/My Include FilePath.inc"" %}
{% include '/my IncludeFolder/My Include FilePath4.inc' %}
{% include '/my IncludeFolder/My Include FilePath5.inc'%}
{% include '/my IncludeFolder/My Include FilePath6.inc'-%}
{% include '/my IncludeFolder/My Include FilePath7.inc' someParam:'someVal' %}
{% include '/my IncludeFolder/My Include FilePath8.inc' someParam:'someVal'%}
{% include '/my IncludeFolder/My Include FilePath9.inc' someParam:'{{someVal}}'-%}
{% include '/my IncludeFolder/My Include FilePath10.inc', someParam:'someVal' %}
{% include '/my IncludeFolder/My Include FilePath11.inc', someParam:'{{someVal}}'%}
{% include '/my IncludeFolder/My Include FilePath12.inc', someParam:'someVal'-%}
{% include '/shouldNotBeFound IncludeFolder/{{someVar}}/My Include FilePath.inc' %}
{% component type:""any"", layout : ""/my LayoutFolder/My Layout FilePath1.inc"" %}
{% component type:""any"", layout:'/my LayoutFolder/My Layout FilePath2.inc' %}
{% component type:""any"", layout:'/my LayoutFolder/My Layout FilePath3.inc'-%}
{% component type:""any"", layout : '/my LayoutFolder/My Layout FilePath4.inc' %}
{% component type:""any"", layout:'/my LayoutFolder/My Layout FilePath5.inc' %}
{% component type:""any"", layout:'/my LayoutFolder/My Layout FilePath6.inc'-%}
{% component type:""any"", layout : '/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath.inc' %}
{% component type:""any"", layout:'/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath.inc' %}
{% component type:""any"", layout:'/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath.inc'-%}
{% component type:""module"", layout : ""/shouldNotBeFound LayoutFolder/My Layout FilePath_m_.inc"" %}
{% component type:""module"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath_m_.inc' %}
{% component type:""module"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath_m_.inc'-%}
{% component type:""module"", layout : '/shouldNotBeFound LayoutFolder/My Layout FilePath_m_.inc' %}
{% component type:""module"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath_m_.inc' %}
{% component type:""module"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath_m_.inc'-%}
{% component type:""module"", layout : '/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath_m_.inc' %}
{% component type:""module"", layout:'/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath_m_.inc' %}
{% component type:""module"", layout:'/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath_m_.inc'-%}
{% component tyddpe:""d"", layout : ""/shouldNotBeFound LayoutFolder/My Layout FilePath__m.inc"", type:""module"" %}
{% component tyddpe:""d"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath__m.inc', type:""module"" %}
{% component tyddpe:""d"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath__m.inc', type:""module""-%}
{% component tyddpe:""d"", layout : '/shouldNotBeFound LayoutFolder/My Layout FilePath__m.inc', type:""module"" %}
{% component tyddpe:""d"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath__m.inc', type:""module"" %}
{% component tyddpe:""d"", layout:'/shouldNotBeFound LayoutFolder/My Layout FilePath__m.inc', type:""module""-%}
{% component tyddpe:""d"", layout : '/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath__m.inc', type:""module"" %}
{% component tyddpe:""d"", layout:'/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath__m.inc', type:""module"" %}
{% component tyddpe:""d"", layout:'/shouldNotBeFound LayoutFolder/{{someVar}}/My Layout FilePath__m.inc', type:""module""-%}
{% component source_type: ""path"", source: ""/my JsonFolder/My Json FilePath1.json"", layout: ""/my LayoutFolder/My Layout FilePath7.inc"", collectionVariable: ""some"", type: ""json"" %}
{% component source_type: ""path"", source: ""/shouldNotBeFound JsonFolder/{{someVar}}/My Json FilePath.json"", layout: ""/my LayoutFolder/My Layout FilePath8.inc"", collectionVariable: ""some"", type: ""json"" %}
{% component source_type: ""url"", source: ""/shouldNotBeFound JsonFolder/My Json FilePath.json"", layout: ""/my LayoutFolder/My Layout FilePath9.inc"", collectionVariable: ""some"", type: ""json"" %}
{% component source_type: ""string"", source: ""/shouldNotBeFound JsonFolder/My Json FilePath.json"", layout: ""/my LayoutFolder/My Layout FilePath10.inc"", collectionVariable: ""some"", type: ""json"" %}
{% component source: ""/my JsonFolder/My Json FilePath2.json"", layout: ""/my LayoutFolder/My Layout FilePath11.inc"", collectionVariable: ""some"",source_type: ""path"", type: ""json"" %}
{% component source: ""/shouldNotBeFound JsonFolder/{{someVar}}/My Json FilePath.json"", layout: ""/my LayoutFolder/My Layout FilePath12.inc"", collectionVariable: ""some"",source_type: ""path"", type: ""json"" %}
{% component source: ""/shouldNotBeFound JsonFolder/My Json FilePath.json"", layout: ""/my LayoutFolder/My Layout FilePath13.inc"", collectionVariable: ""some"",source_type: ""url"", type: ""json"" %}
{% component source: ""/shouldNotBeFound JsonFolder/My Json FilePath.json"", layout: ""/my LayoutFolder/My Layout FilePath14.inc"", collectionVariable: ""some"",source_type: ""string"", type: ""json"" %}
{% component resource: ""File System"", folder: ""/"", type: ""api"" %}
{% component resource: ""File System"", folder: ""/MyFolder2"", type: ""api"" %}
{% component resource: 'File System', folder : '/MyFolder3', type: 'api' %}
{% component resource: 'File System', folder:'/MyFolder4', type: 'api' %}
{% component resource: 'File System', folder:'/ShouldNotBefoundFolder', type: 'module' %}
{% component resource: 'File System', folder:""/ShouldNotBefoundFolder"", type: 'module' %}
{% component moduleItemId: ""{{this.Id}}"", limit: ""10"", commentLimit: ""5"", commentLayout: ""/my commentLayoutFolder/layout1.inc"", type: ""commentThreads"" %}
{% component moduleItemId: '{{this.Id}}', limit: '10', commentLimit: '5', commentLayout: '/my commentLayoutFolder/layout2.inc', type: 'commentThreads' %}