Skip to content

Instantly share code, notes, and snippets.

@NikiforovAll
Created August 12, 2022 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NikiforovAll/05b64a1259bf1d21aa660de0f61a76e1 to your computer and use it in GitHub Desktop.
Save NikiforovAll/05b64a1259bf1d21aa660de0f61a76e1 to your computer and use it in GitHub Desktop.
Search in XML <flowable:eventInParameter>
using Spectre.Console;
using System.Text.RegularExpressions;
foreach (var file in new DirectoryInfo(@"./bpmn-models").GetFiles("*.bpmn"))
{
ProcessFile(file);
}
void ProcessFile(FileInfo file)
{
using var stream = file.OpenRead();
using var reader = new StreamReader(stream);
var text = reader.ReadToEnd();
var matches = Regex.Matches(text,
@"<flowable:eventInParameter.*(&quot;(?<label>(\w+\s+.\w*)+)&quot;)(?=\:\s&quot;\${(?<varname>.*)\}&quot;).*flowable:eventInParameter>");
var table = new Table();
table.AddColumn(file.Name);
table.AddColumn("Label");
table.AddColumn("Variable Name");
foreach (Match match in matches)
{
table.AddRow(
match.ToString(),
match.Groups["label"].ToString(),
match.Groups["varname"].ToString());
}
if (matches.Any())
{
AnsiConsole.Write(table);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment