diff --git a/lottery-co-uk-scraper/NationalLottery/DrawWinnerInformation.cs b/lottery-co-uk-scraper/NationalLottery/DrawWinnerInformation.cs index 1989c3c..e536670 100644 --- a/lottery-co-uk-scraper/NationalLottery/DrawWinnerInformation.cs +++ b/lottery-co-uk-scraper/NationalLottery/DrawWinnerInformation.cs @@ -7,7 +7,7 @@ using System.Text.RegularExpressions; namespace lottery_co_uk_scraper.NationalLottery { - internal class DrawWinnerInformation + internal partial class DrawWinnerInformation { public static void ProcessTableSection(HtmlNode table, string sectionTitle, LottoResult lottoResult) { @@ -419,7 +419,7 @@ namespace lottery_co_uk_scraper.NationalLottery var textNodes = htmlDoc.DocumentNode.DescendantsAndSelf().Where(n => n.NodeType == HtmlNodeType.Text); - var numericValues = textNodes.SelectMany(n => Regex.Matches(n.InnerHtml, @"(\d+)").Cast()) + var numericValues = textNodes.SelectMany(n => MyRegex().Matches(n.InnerHtml).Cast()) .Select(match => int.Parse(match.Groups[1].Value)) .ToList(); @@ -449,7 +449,6 @@ namespace lottery_co_uk_scraper.NationalLottery string columnTitle = prizePerWinnerNode.Attributes["data-title"].Value; - // Now you can use regularPrizePerWinner and rolldownPrizePerWinner as needed Console.WriteLine($"Prize per winner ({sectionTitle}): {regularPrizePerWinner}"); Console.WriteLine($"Rolldown Prize per winner ({sectionTitle}): {rolldownPrizePerWinner}"); @@ -531,5 +530,8 @@ namespace lottery_co_uk_scraper.NationalLottery { AssignValueToModelProperty(sectionTitle, columnTitle, LotteryTableRow.Total, winnersNode, lottoResult); } + + [GeneratedRegex(@"(\d+)")] + private static partial Regex MyRegex(); } } \ No newline at end of file