using System.Text.RegularExpressions;
using System.Collections.Generic;
public class AspxJsParser
public string Name { get; set; }
public string Description { get; set; }
public string Code { get; set; }
public static List<JsFunction> ParseAspxFile(string filePath)
string content = "<%\r\n '//* 関数名:on_end()\r\n '//* 機 能:終了押下時\r\n '//*********************************************************************\r\n%>\r\nfunction on_end(){\r\n document.form1.DO_SUBMIT.value = \"終了\"\r\n}";
List<JsFunction> functions = new List<JsFunction>();
string pattern = @"<%\s*(?<comment>'/\*.*?\*/.*?'/)?\s*%>\s*function\s+(?<name>\w+)\s*\(.*?\)\s*{(?<code>.*?)}";
MatchCollection matches = Regex.Matches(content, pattern, RegexOptions.Singleline);
foreach (Match match in matches)
JsFunction func = new JsFunction
Name = match.Groups["name"].Value,
Description = match.Groups["comment"].Value.Trim(),
Code = match.Groups["code"].Value.Trim()
public static void Main(string[] args)
string filePath = "path/to/your/file.aspx";
List<JsFunction> functions = ParseAspxFile(filePath);
foreach (var func in functions)
Console.WriteLine($"Function Name: {func.Name}");
Console.WriteLine($"Description: {func.Description}");
Console.WriteLine($"Code: {func.Code}");
Console.WriteLine($"111");