using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); var txt = "

xyz

Hello

World

"; t.Text = txt; // Parent rule matches the

tag. Its local transformer then extracts the 'id' attribute. var parentRule = t.Pattern("

"); parentRule.LocalTransformer.FromTo("id={@string:id}", "{id}"); t.Filter(); Console.WriteLine("--- All Matches (Parent and Child) ---"); Console.WriteLine(t.GetMatches(MatchesOption.All).Text); Console.WriteLine(""); Console.WriteLine("--- RootLevelOnly (Parent Matches) ---"); Console.WriteLine(t.GetMatches(MatchesOption.RootLevelOnly).Text); Console.WriteLine(""); Console.WriteLine("--- InnermostOnly (Child Matches) ---"); Console.WriteLine(t.GetMatches(MatchesOption.InnermostOnly).Text);