Skip to content

Commit

Permalink
Added optional regex capture group
Browse files Browse the repository at this point in the history
Optional capture group "(?:<div style=""clear: right""></div>\s*)?" matches new styling on workshop pages; fixes changelogs (again)
  • Loading branch information
Alyssa4854 authored and RevZero committed Jul 2, 2024
1 parent 44c0595 commit 8222f08
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ public static class ModChangelogCache
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(nameof(ModChangelogCache));
private static readonly ConcurrentDictionary<long, string> Cache = new ConcurrentDictionary<long, string>();

private static readonly Regex Regexp = new Regex(@"<div class=""detailBox workshopAnnouncement noFooter changeLogCtn"">\s*<div class=""changelog headline"">\s*(.*)\s*</div>\s*<p id=""[0-9]+"">(.*)</p>", RegexOptions.Compiled);
private static readonly Regex Regexp = new Regex(
@"<div class=""detailBox workshopAnnouncement noFooter changeLogCtn"">\s*" +
@"<div class=""changelog headline"">\s*(.*?)\s*</div>\s*" +
@"(?:<div style=""clear: right""></div>\s*)?" +
@"<p id=""[0-9]+"">((?:.|\n)*?)</p>",
RegexOptions.Compiled);

public static async Task<string> GetChangeLogAsync(long workshopID)
{
Expand Down

0 comments on commit 8222f08

Please sign in to comment.