Fix Kick emote regex so it's less greedy and can handle consecutive emotes with no space

This commit is contained in:
barelyprofessional
2024-03-26 16:35:45 +08:00
parent 3a972cd32c
commit bdabe29b83

View File

@@ -7,7 +7,7 @@ public static class Extensions
/// Emotes are encoded like [emote:161238:russW] which translates to -> https://files.kick.com/emotes/161238/fullsize /// Emotes are encoded like [emote:161238:russW] which translates to -> https://files.kick.com/emotes/161238/fullsize
public static string TranslateKickEmotes(this string s) public static string TranslateKickEmotes(this string s)
{ {
Regex regex = new Regex(@"\[(.+?):(\d+):(\S+)\]"); Regex regex = new Regex(@"\[(.+?):(\d+):(\S+?)\]");
var matches = regex.Matches(s); var matches = regex.Matches(s);
if (matches.Count == 0) if (matches.Count == 0)
{ {